How to convert string to unicode using PostgreSQL?

Here I want to convert my string to unicode. I am using PostgreSQL version 9.3. In SQL Server, this is much simpler:

An example :

   sql = N'select * from tabletest'; /* For nvarchar/nchar/ntext */

OR

   sql = U'select * from tabletest'; /* For varchar/char/text */

Question . How can I do the above conversion in PostgreSQL?

0
source share
1 answer

PostgreSQL databases have their own character type, "server encoding." This is usually utf-8.

All text in this encoding. Mixed encoding text is not supported unless it is stored as bytea(i.e., as opaque byte sequences).

"unicode" "un-unicode", PostgreSQL "varchar" "nvarchar". utf-8 , 7- ASCII ( ), , , . utf-8 , ucs-2 utf-16 , "" , , .

PostgreSQL / , client_encoding. .

"Unicode" ( Microsoft , UCS-2 UTF-16), utf-8 โ†” utf-16 .

, , - client_encoding, , . ( , PgJDBC, nPgSQL Unicode psqlODBC).

:

+6

Source: https://habr.com/ru/post/1684885/


All Articles