You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -141,11 +141,9 @@ Valid Values: <name>
141
141
Default: none
142
142
```
143
143
144
-
Sets the charset used for client-server interaction (`"SET NAMES <value>"`). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
144
+
Sets the charset used for client-server interaction (`"SET NAMES <value>"`). If multiple charsets are set (separated by a comma), the following charset is used if setting the charset failes. This enables for example support for `utf8mb4` ([introduced in MySQL 5.5.3](http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html)) with fallback to `utf8` for older servers (`charset=utf8mb4,utf8`).
145
145
146
-
*Please note:*
147
-
148
-
Usage of the `charset` parameter is discouraged because it issues queries.
146
+
Usage of the `charset` parameter is discouraged because it issues additional queries to the server.
149
147
Unless you need the fallback behavior, please use `collation` instead.
150
148
151
149
##### `collation`
@@ -156,7 +154,7 @@ Valid Values: <name>
156
154
Default: utf8_general_ci
157
155
```
158
156
159
-
Sets the collation used for client-server interaction on connection. In contrast to `charset`, `collation` does not issue queries. If the specified collation is unavailable on the target server, the connection will fail.
157
+
Sets the collation used for client-server interaction on connection. In contrast to `charset`, `collation` does not issue additional queries. If the specified collation is unavailable on the target server, the connection will fail.
160
158
161
159
A list of valid charsets for a server is retrievable with `SHOW COLLATION`.
@@ -311,7 +309,11 @@ Alternatively you can use the [`NullTime`](http://godoc.org/github.com/go-sql-dr
311
309
312
310
313
311
### Unicode support
314
-
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.
312
+
Since version 1.1 Go-MySQL-Driver automatically uses the collation `utf8_general_ci` by default.
313
+
314
+
Other collations / charsets can be set using the [`collation`](#collation) DSN parameter.
315
+
316
+
Version 1.0 of the driver recommended adding `&charset=utf8` (alias for `SET NAMES utf8`) to the DSN to enable proper UTF-8 support. This is not necessary anymore. The [`collation`](#collation) parameter should be preferred to set another collation / charset than the default.
315
317
316
318
See http://dev.mysql.com/doc/refman/5.7/en/charset-unicode.html for more details on MySQL's Unicode support.
0 commit comments