Skip to content

Commit 48817fd

Browse files
committed
Add note on Unicode support
1 parent ca5611d commit 48817fd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ A MySQL-Driver for Go's [database/sql](http://golang.org/pkg/database/sql) packa
2121
* [Examples](#examples)
2222
* [LOAD DATA LOCAL INFILE support](#load-data-local-infile-support)
2323
* [time.Time support](#timetime-support)
24+
* [Unicode support](#unicode-support)
2425
* [Testing / Development](#testing--development)
2526
* [License](#license)
2627

@@ -126,11 +127,11 @@ user@unix(/path/to/socket)/dbname
126127
```
127128

128129
```
129-
user:password@tcp(localhost:5555)/dbname?charset=utf8&autocommit=true
130+
user:password@tcp(localhost:5555)/dbname?autocommit=true
130131
```
131132

132133
```
133-
user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname?charset=utf8mb4,utf8
134+
user:password@tcp([de:ad:be:ef::ca:fe]:80)/dbname?tls=skip-verify&charset=utf8mb4,utf8
134135
```
135136

136137
```
@@ -154,6 +155,7 @@ To use a `io.Reader` a handler function must be registered with `mysql.RegisterR
154155

155156
See also the [godoc of Go-MySQL-Driver](http://godoc.org/github.com/go-sql-driver/mysql "golang mysql driver documentation")
156157

158+
157159
### `time.Time` support
158160
The default internal output type of MySQL `DATE` and `DATETIME` values is `[]byte` which allows you to scan the value into a `[]byte`, `string` or `sql.RawBytes` variable in your programm.
159161

@@ -164,6 +166,11 @@ However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` v
164166
Alternatively you can use the [`NullTime`](http://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`.
165167

166168

169+
### Unicode support
170+
Since version 1.1 Go-MySQL-Driver automatically uses the collation `utf8_general_ci` by default. Adding `&charset=utf8` (alias for `SET NAMES utf8`) to the DSN is not necessary anymore in most cases.
171+
172+
See http://dev.mysql.com/doc/refman/5.7/en/charset-unicode.html for more details on MySQL's Unicode support.
173+
167174

168175
## Testing / Development
169176
To run the driver tests you may need to adjust the configuration. See the [Testing Wiki-Page](https://github.com/go-sql-driver/mysql/wiki/Testing "Testing") for details.

0 commit comments

Comments
 (0)