While inserting some data in a Latin1 Postgres 9.1.3 I get the error:
character 0xe28093 of encoding "UTF8" has no equivalent in "LATIN1"
The data is being inserted by a Grails application. I've tried the following with no success:
hibernate { connection.characterEncoding='utf8'}
?charSet=LATIN1 in the jdbc conn string
hibernate { connection.charSet='LATIN1'}
The database were created with:
CREATE DATABASE mydb
WITH OWNER = postgres
ENCODING = 'LATIN1'
TABLESPACE = pg_default
LC_COLLATE = 'C'
LC_CTYPE = 'C'
CONNECTION LIMIT = -1;
Any idea? Thank you in advance.
If I understand you correctly your database has been created with the encoding "LATIN1". This encoding cannot be changed after the DB has been created. The only thing you can change - as shown by your bullet points - is the encoding between your client and the PostgreSQL server. The PostgreSQL server then tries to translate between the client encoding and the database encoding.
This process of course fails if when the client transmits data which cannot be translated into the DB encoding. In your case the Unicode codepoint 2013 cannot be translated into LATIN1.
This means you have to clean all data going to the database. Fiddling with the client encodings will not help.
That is the UTF-8 encoding for the en dash symbol. The closest equivalent in the latin1 character set would be character code 150 (0x96).
Related
I'm using pgAdmin IV (version 5.7) now because of my job, previously I only had used pgAdmin III.
My problem is that I have already set the charset correctly with
set client_encoding = 'Win1252';
and when I execute a select, this error still appears. I'm connected to the same database with both, and the database I'm linking to is Postgres 9.5. When I do the same with pgAdmin III, I get all the data correctly.
When I run show server_encoding on the database I receive **WIN1252*:
Error:
'charmap' codec can't decode byte 0x8d in position 8773: character
maps to <undefined>
I have successfully installed Postgres 10 in a Windows Server 2008 R2 standard, 64 bit.
I am trying to create a new database that has LC_COLLATE = 'und-x-icu' and LC_CTYPE = 'und-x-icu' with the following SQL
CREATE DATABASE hey
WITH
OWNER = postgres
ENCODING = 'UTF8'
LC_COLLATE = 'und-x-icu'
LC_CTYPE = 'und-x-icu'
TABLESPACE = pg_default
CONNECTION LIMIT = -1
TEMPLATE = template0
;
I get ERROR: invalid locale name: "und-x-icu" SQL state: 42809.
But the SELECT * FROM pg_collation; clearly shows und-x-icu.
The same SQL works on my laptop (windows 10).
I did select locale : C while installing on the server, I did not remember what I selected as a locale while installing on the laptop.
How can I make this work on win server 2008 and get und-x-icu?
The documentation does not seem to mention that restriction, but you cannot use ICU collations in CREATE DATABASE.
This may be improved in the future, but for now there is no way to have an ICU collation as the default collation.
I recently installed PostgreSql and I am trying to create a new database.
Unfortunetly I got and error while creating the database:
"'utf8' codec can't decode byte 0xe9 in position 42: invalid continuation byte"
What is the problem exactly
thank you
Try to add the following line at the end of the pg_hba.conf file and then restart the PostgreSQL service:
host all all all md5
I had a similar error when upgrading from 4.5 to 4.7, the solution was to restart the pgAdmin server.
My error was:
Error: 'utf-8' codec can't decode byte 0xe9 in position 0: invalid continuation byte
It's a conflict between local languages. PgAdmin is in English but maybe in the conf file the lc_messages variable is French, Spanish or something else. Try this
lc_messages = 'en_US'
I tried all the solutions above.
None worked.
The solution for me was to install US ENGLISH as my language on my windows 10.
Then I did the installation all over again in that language.
It's working now, and I do not have use US ENGLISH as my windows language xD
I have a PostgreSQL on Windows 7 machine. And here my data base script:
CREATE DATABASE usersdb
WITH OWNER = postgres
ENCODING = 'UTF8'
TABLESPACE = pg_default
LC_COLLATE = 'Russian_Russia.1251'
LC_CTYPE = 'Russian_Russia.1251'
CONNECTION LIMIT = -1;
My problem in that i see unreadable error in Jetty/Tomcat:
Caused by: org.postgresql.util.PSQLException: ?????: ???????????? "test_user" ?? ?????? ???????? ??????????? (?? ??????)
I try create new db in pgAdmin but there are only LC_COLLATE = 'Russian_Russia.1251' and LC_CTYPE = 'Russian_Russia.1251' i can chose.
How can i solve this problem?
The first place to look, of course, are in the PostgreSQL logs. Those may be better handled than your Jetty/Tomcat instance.
The second question is what client encoding is set. You may want to (via jdbc):
show client_encoding;
Finally lc_messages may need to be adjusted.
FreeTDS version 0.82
unixODBC version 2.3.0
pyodbc version 2.1.8
freetds.conf:
tds version = 7.0
client charset = UTF-8
using Servername in the odbc.ini (which for some crazed reason made a difference in getting unixODBC to recognize the client charset in freetds)
I'm able to pull utf8 data correctly and can update with the string inline ie:
UPDATE table
SET col = N'私はトカイ大好き'
WHERE id = 182333369
But
text = u'私はトカイ大好き'
cursor.execute("""
UPDATE table
SET column = ?
WHERE id = 182333369
""", text)
Fails with:
pyodbc.Error: ('HY004', '[HY004] [FreeTDS][SQL Server]
Invalid data type (0) (SQLBindParameter)')
If I add:
text = text.encode('utf-8')
I get the following error:
pyodbc.ProgrammingError: ('42000', '[42000] [FreeTDS][SQL Server]The incoming tabular data stream (TDS) protocol stream is incorrect. The stream ended unexpectedly. (4002) (SQLExecDirectW)')
Any ideas as to where things have gone astray?
Unicode support was reworked in pyodbc 3.0.x. Try testing with the latest source (3.0.2-beta02, etc.)