In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Error message: peimsmdb=# select'I'; ERROR: character with byte sequence 0xe6 0x88 0x91 in encoding "UTF8" has no equivalent in encoding "LATIN1"
View the client character set: peimsmdb=# show client_encoding; client_encoding-UTF8
Peimsmdb=# show server_encoding; server_encoding-LATIN1
Idea: because the environment variables are not modified, resulting in the database being installed, the default character set of the database becomes LATIN1, as shown below.
Postgres=#\ l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges-+-- peimsmdb | peimsmer | LATIN1 | en_US | en_US | = Tc/peimsmer + | peimsmer=CTc/ Peimsmer postgres | postgres | LATIN1 | en_US | en_US | template0 | postgres | LATIN1 | en_US | en_US | = c/postgres + | postgres=CTc/postgres template1 | postgres | LATIN1 | en_US | en_US | = c/postgres + | postgres=CTc/postgres (4 rows)
So if you modify the environment variable in the first place, there will be no later problems. Modify the environment variable # vi / etc/profileexport.UTF-8export LC_ALL=en_US.UTF-8export LC_CTYPE=en_US.UTF-8
# source / etc/profile
Now that the database is installed, the solution can only be to specify the character set when building the database.
First modify the environment variable
Command reference: create database DATABASENAME with encoding = 'UTF8' LC_CTYPE =' en_US.UTF-8' LC_COLLATE = 'en_US.UTF-8' template = template1
The template0 and template1 tables are processed before building the library.
# psql-U postgres-d postgres-h 127.0.0.1
Postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';UPDATE 1postgres=#\ c template0You are now connected to database "template0" as user "postgres" .template0 = # update pg_database set datistemplate = FALSE where datname =' template1';UPDATE 1template0=# drop database template1;DROP DATABASEtemplate0=# create database template1 with encoding = 'UTF8' LC_CTYPE =' en_US.UTF-8' LC_COLLATE = 'en_US.UTF-8' template = template0;CREATE DATABASEtemplate0=# update pg_database set datallowconn = TRUE where datname =' template1' UPDATE 1template0=#\ c template1You are now connected to database "template1" as user "postgres" .template1 = # update pg_database set datallowconn = FALSE where datname = 'template0';UPDATE 1 reference: https://blog.csdn.net/hkyw000/article/details/52817422
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.