{"Entry":{"collection":"guc","key":"client_encoding","name":"client_encoding","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Client Connection Defaults / Locale and Formatting","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"9.0","status":"changed","to":"9.1"},{"documentation_changed":true,"fields":{},"from":"9.5","status":"changed","to":"9.6"},{"documentation_changed":true,"fields":{},"from":"13","status":"changed","to":"14"},{"documentation_changed":true,"fields":{},"from":"16","status":"changed","to":"17"}],"content_hash":"00ecf73d80240efb724f321016e1f90435fa2202c1341eb2cbc632742110cf2f","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"SQL_ASCII"}],"derived_content_hash":"fd0d2d5938bfd1d6c732b585212103aa4ada03885b633b5ef8666b3b6bf6877e","editorial":{"advice":{"olap":"Pin client_encoding for export, reporting, and reproducible analytical jobs; prefer explicit SQL formatting when a file or API has a durable schema.","oltp":"Treat client_encoding as an application contract, not a performance knob. Standardize it per role or connection pool and keep wire formats explicit where clients parse text.","small":"Keep the upstream or locale-derived value unless a client requires another one. A smaller server gains no capacity from changing client_encoding."},"mechanism":["client_encoding sets the client's character set encoding. PostgreSQL converts text between this encoding and the database encoding when a supported conversion exists; SQL_ASCII disables useful validation rather than identifying a real character set.","client_encoding is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","It changes representation, parsing, or locale behavior at the client boundary rather than physical storage. Coordinate it with the other locale and formatting settings and with driver-native binary or typed protocols."],"pitfalls":["Changing client_encoding in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","Assuming a presentation setting changes stored values or server-side type semantics.","Changing a role or database default without testing text-parsing clients, exports, and pooled sessions.","Using SQL_ASCII as if it were an encoding and allowing invalid byte sequences to cross the client boundary."],"references":[{"title":"PostgreSQL 19 Beta 4: client_encoding","url":"https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-CLIENT-ENCODING"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["lc_messages","lc_monetary","lc_numeric","lc_time","default_text_search_config"],"summary":"client_encoding is the PostgreSQL setting that defines the client's character set encoding."},"enumvals":[],"first_version":"7.4","group":"Client Connection Defaults","group_slug":"client","imported_at":"2026-09-27T17:57:30.94539+08:00","intro_commit":{},"key":"client_encoding","last_version":"20","max_val":"","min_val":"","name":"client_encoding","position":61,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"english-manuals:89f4d0d529f0f591ac16a49a8692a485155c91b2424ea9ff1f81e79c749be32e","receipt_sha256":"638fb61ed854b3eac5e55a05e5922905e50d18f9d715fecace397315ac214127","repair":"wiki-repair-20261023"},"short_desc":"Sets the client-side encoding (character set).","short_desc_zh":"","source_rev":"wiki-repair-20261023:4f77cda2799401401905315b47168e6efd7d9106b1a592a2552494c185913e53","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"client_encoding","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"client_encoding","SourceRevision":"wiki-repair-20261023:4f77cda2799401401905315b47168e6efd7d9106b1a592a2552494c185913e53","Facts":{"boot_val":"SQL_ASCII","category":"Client Connection Defaults / Locale and Formatting","context":"user","description":"Sets the client-side encoding (character set). The default is to use the database encoding. The character sets supported by the PostgreSQL server are described in Section 23.3.1.","description_zh":"设置客户端编码（字符集）。默认使用数据库编码。PostgreSQL 服务器所支持的字符集在第 23.3.1 节中描述。","description_zh_html":"\u003cp\u003e\n        设置客户端编码（字符集）。默认使用数据库编码。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 服务器所支持的字符集在\u003ca class=\"xref\" href=\"/zh/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. 支持的字符集\"\u003e第 23.3.1 节\u003c/a\u003e中描述。\n       \u003c/p\u003e","doc":{"anchor":"GUC-CLIENT-ENCODING","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"client_encoding","short_desc":"Sets the client's character set encoding.","source":"pg-settings-source-snapshot","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/runtime-config-client.html","sha256":"1882f8fd5576909c4fcc44af53077378871e05f5be67723f20fe300273024767"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"unit":null,"vartype":"string","zh_from":"same-version-pgdoc"},"ManualEvidence":{"doc":{"anchor":"GUC-CLIENT-ENCODING","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"client_encoding","SourceDatabase":"center","Version":"18","Locale":"en","Title":"client_encoding","Summary":"Sets the client-side encoding (character set). The default is to use the database encoding. The character sets supported by the PostgreSQL server are described in Section 23.3.1.","BodyHTML":"\u003cp\u003eSets the client-side encoding (character set). The default is to use the database encoding. The character sets supported by the PostgreSQL server are described in Section 23.3.1.\u003c/p\u003e","SourceRevision":"wiki-repair-20261023:4f77cda2799401401905315b47168e6efd7d9106b1a592a2552494c185913e53","ContentHash":"fd972c54e3979dbb209323b063f7ad07111855f17fe32e82e9bc3a48ff177690","Payload":{"description":"Sets the client-side encoding (character set). The default is to use the database encoding. The character sets supported by the PostgreSQL server are described in Section 23.3.1."}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
