📄 charset.sgml
字号:
<entry><emphasis>ISO_8859_6</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>ISO_8859_7</literal></entry> <entry><emphasis>ISO_8859_7</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>ISO_8859_8</literal></entry> <entry><emphasis>ISO_8859_8</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>JOHAB</literal></entry> <entry><emphasis>JOHAB</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>KOI8</literal></entry> <entry><emphasis>KOI8</emphasis>, <literal>ISO_8859_5</literal>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal>, <literal>WIN866</literal>, <literal>WIN1251</literal> </entry> </row> <row> <entry><literal>LATIN1</literal></entry> <entry><emphasis>LATIN1</emphasis>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN2</literal></entry> <entry><emphasis>LATIN2</emphasis>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal>, <literal>WIN1250</literal> </entry> </row> <row> <entry><literal>LATIN3</literal></entry> <entry><emphasis>LATIN3</emphasis>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN4</literal></entry> <entry><emphasis>LATIN4</emphasis>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN5</literal></entry> <entry><emphasis>LATIN5</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN6</literal></entry> <entry><emphasis>LATIN6</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN7</literal></entry> <entry><emphasis>LATIN7</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN8</literal></entry> <entry><emphasis>LATIN8</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN9</literal></entry> <entry><emphasis>LATIN9</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>LATIN10</literal></entry> <entry><emphasis>LATIN10</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>MULE_INTERNAL</literal></entry> <entry><emphasis>MULE_INTERNAL</emphasis>, <literal>BIG5</literal>, <literal>EUC_CN</literal>, <literal>EUC_JP</literal>, <literal>EUC_KR</literal>, <literal>EUC_TW</literal>, <literal>ISO_8859_5</literal>, <literal>KOI8</literal>, <literal>LATIN1</literal> to <literal>LATIN4</literal>, <literal>SJIS</literal>, <literal>WIN866</literal>, <literal>WIN1250</literal>, <literal>WIN1251</literal> </entry> </row> <row> <entry><literal>SJIS</literal></entry> <entry><emphasis>not supported as a server encoding</emphasis> </entry> </row> <row> <entry><literal>SQL_ASCII</literal></entry> <entry><emphasis>any (no conversion will be performed)</emphasis> </entry> </row> <row> <entry><literal>UHC</literal></entry> <entry><emphasis>not supported as a server encoding</emphasis> </entry> </row> <row> <entry><literal>UTF8</literal></entry> <entry><emphasis>all supported encodings</emphasis> </entry> </row> <row> <entry><literal>WIN866</literal></entry> <entry><emphasis>WIN866</emphasis>, <literal>ISO_8859_5</literal>, <literal>KOI8</literal>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal>, <literal>WIN1251</literal> </entry> </row> <row> <entry><literal>WIN874</literal></entry> <entry><emphasis>WIN874</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>WIN1250</literal></entry> <entry><emphasis>WIN1250</emphasis>, <literal>LATIN2</literal>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>WIN1251</literal></entry> <entry><emphasis>WIN1251</emphasis>, <literal>ISO_8859_5</literal>, <literal>KOI8</literal>, <literal>MULE_INTERNAL</literal>, <literal>UTF8</literal>, <literal>WIN866</literal> </entry> </row> <row> <entry><literal>WIN1252</literal></entry> <entry><emphasis>WIN1252</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>WIN1256</literal></entry> <entry><emphasis>WIN1256</emphasis>, <literal>UTF8</literal> </entry> </row> <row> <entry><literal>WIN1258</literal></entry> <entry><emphasis>WIN1258</emphasis>, <literal>UTF8</literal> </entry> </row> </tbody> </tgroup> </table> <para> To enable automatic character set conversion, you have to tell <productname>PostgreSQL</productname> the character set (encoding) you would like to use in the client. There are several ways to accomplish this: <itemizedlist> <listitem> <para> Using the <command>\encoding</command> command in <application>psql</application>. <command>\encoding</command> allows you to change client encoding on the fly. For example, to change the encoding to <literal>SJIS</literal>, type:<programlisting>\encoding SJIS</programlisting> </para> </listitem> <listitem> <para> Using <application>libpq</> functions. <command>\encoding</command> actually calls <function>PQsetClientEncoding()</function> for its purpose.<synopsis>int PQsetClientEncoding(PGconn *<replaceable>conn</replaceable>, const char *<replaceable>encoding</replaceable>);</synopsis> where <replaceable>conn</replaceable> is a connection to the server, and <replaceable>encoding</replaceable> is the encoding you want to use. If the function successfully sets the encoding, it returns 0, otherwise -1. The current encoding for this connection can be determined by using:<synopsis>int PQclientEncoding(const PGconn *<replaceable>conn</replaceable>);</synopsis> Note that it returns the encoding ID, not a symbolic string such as <literal>EUC_JP</literal>. To convert an encoding ID to an encoding name, you can use:<synopsis>char *pg_encoding_to_char(int <replaceable>encoding_id</replaceable>);</synopsis> </para> </listitem> <listitem> <para> Using <command>SET client_encoding TO</command>. Setting the client encoding can be done with this SQL command:<programlisting>SET CLIENT_ENCODING TO '<replaceable>value</>';</programlisting> Also you can use the more standard SQL syntax <literal>SET NAMES</literal> for this purpose:<programlisting>SET NAMES '<replaceable>value</>';</programlisting> To query the current client encoding:<programlisting>SHOW client_encoding;</programlisting> To return to the default encoding:<programlisting>RESET client_encoding;</programlisting> </para> </listitem> <listitem> <para> Using <envar>PGCLIENTENCODING</envar>. If the environment variable <envar>PGCLIENTENCODING</envar> is defined in the client's environment, that client encoding is automatically selected when a connection to the server is made. (This can subsequently be overridden using any of the other methods mentioned above.) </para> </listitem> <listitem> <para> Using the configuration variable <xref linkend="guc-client-encoding">. If the <varname>client_encoding</> variable is set, that client encoding is automatically selected when a connection to the server is made. (This can subsequently be overridden using any of the other methods mentioned above.) </para> </listitem> </itemizedlist> </para> <para> If the conversion of a particular character is not possible — suppose you chose <literal>EUC_JP</literal> for the server and <literal>LATIN1</literal> for the client, then some Japanese characters cannot be converted to <literal>LATIN1</literal> — it is transformed to its hexadecimal byte values in parentheses, e.g., <literal>(826C)</literal>. </para> <para> If the client character set is defined as <literal>SQL_ASCII</>, encoding conversion is disabled, regardless of the server's character set. Just as for the server, use of <literal>SQL_ASCII</> is unwise unless you are working with all-ASCII data. </para> </sect2> <sect2> <title>Further Reading</title> <para> These are good sources to start learning about various kinds of encoding systems. <variablelist> <varlistentry> <term><ulink url="http://www.i18ngurus.com/docs/984813247.html"></ulink></term> <listitem> <para> An extensive collection of documents about character sets, encodings, and code pages. </para> </listitem> </varlistentry> <varlistentry> <term><ulink url="ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/cjk.inf"></ulink></term> <listitem> <para> Detailed explanations of <literal>EUC_JP</literal>, <literal>EUC_CN</literal>, <literal>EUC_KR</literal>, <literal>EUC_TW</literal> appear in section 3.2. </para> </listitem> </varlistentry> <varlistentry> <term><ulink url="http://www.unicode.org/"></ulink></term> <listitem> <para> The web site of the Unicode Consortium </para> </listitem> </varlistentry> <varlistentry> <term>RFC 2044</term> <listitem> <para> <acronym>UTF</acronym>-8 is defined here. </para> </listitem> </varlistentry> </variablelist> </para> </sect2> </sect1></chapter><!-- Keep this comment at the end of the fileLocal variables:mode:sgmlsgml-omittag:nilsgml-shorttag:tsgml-minimize-attributes:nilsgml-always-quote-attributes:tsgml-indent-step:1sgml-indent-data:tsgml-parent-document:nilsgml-default-dtd-file:"./reference.ced"sgml-exposed-tags:nilsgml-local-catalogs:("/usr/lib/sgml/catalog")sgml-local-ecat-files:nilEnd:-->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -