{"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"}],"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"],"short_desc":"Sets the client-side encoding (character set).","short_desc_zh":"","source_rev":"english-manuals:89f4d0d529f0f591ac16a49a8692a485155c91b2424ea9ff1f81e79c749be32e","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"client_encoding","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"client_encoding","SourceRevision":"english-manuals:89f4d0d529f0f591ac16a49a8692a485155c91b2424ea9ff1f81e79c749be32e","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.","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","unit":null,"vartype":"string"},"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":"pgweb","Version":"18","Locale":"zh-Hans","Title":"client_encoding","Summary":"","BodyHTML":"\u003cp\u003e设置客户端编码（字符集）。默认使用数据库编码。\u003cspan\u003ePostgreSQL\u003c/span\u003e服务器所支持的字符集在\u003ca href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" rel=\"nofollow\"\u003e第 23.3.1 节\u003c/a\u003e中描述。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"004cf1559a3548f4511cd1db61853d7407c01e26a150368600488a30ac376de3","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e设置客户端编码（字符集）。默认使用数据库编码。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e服务器所支持的字符集在\u003ca href=\"/docs/18/multibyte.html#MULTIBYTE-CHARSET-SUPPORTED\" title=\"23.3.1. 支持的字符集\"\u003e第 23.3.1 节\u003c/a\u003e中描述。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","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}
