Thread: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
Hi, I have recently migrated to 9.4.4 from 9.1. I did a dump and restore to migrate the database. When I try to connect usingJDBC I am getting the following error, the database encoding is SQL_ASCII. Same error with postgresql-9.4-1201.jdbc4.jar & postgresql-9.1-902.jdbc4.jar. org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x92 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:305) at com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:567) Command used to create the database /usr/local/pgsql/bin/createdb --encoding=SQL_ASCII --template=template0 db_server Thanks, Prasanth
Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Vladimir Sitnikov
Date:
Can you share the query and parameters that reproduce the failure? For instance, can you please set loglevel=2 connection property and provide "FE=> Bind", "FE=> Describe", etc stdout messages that precede "invalid byte sequence" error? Vladimir
Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Prasanth Reddy
Date:
From log file:
ERROR: invalid byte sequence for encoding "UTF8": 0x92
STATEMENT: SELECT * FROM client_data WHERE status_code = 0 ORDER BY client_name, description
Code that causes it:
String sql = "SELECT * FROM client_data WHERE status_code = 0 ORDER BY client_name, description";
ResultSet rs = connection.createStatement().executeQuery(sql);
How do I set the connection property?
-------------------------------------------------------------
Can you share the query and parameters that reproduce the failure?
For instance, can you please set loglevel=2 connection property and
provide "FE=> Bind", "FE=> Describe", etc stdout messages that precede
"invalid byte sequence" error?
Vladimir
ERROR: invalid byte sequence for encoding "UTF8": 0x92
STATEMENT: SELECT * FROM client_data WHERE status_code = 0 ORDER BY client_name, description
Code that causes it:
String sql = "SELECT * FROM client_data WHERE status_code = 0 ORDER BY client_name, description";
ResultSet rs = connection.createStatement().executeQuery(sql);
How do I set the connection property?
-------------------------------------------------------------
Can you share the query and parameters that reproduce the failure?
For instance, can you please set loglevel=2 connection property and
provide "FE=> Bind", "FE=> Describe", etc stdout messages that precede
"invalid byte sequence" error?
Vladimir
On 08/07/2015 11:38 AM, Prasanth Reddy wrote:
Hi, I have recently migrated to 9.4.4 from 9.1. I did a dump and restore to migrate the database. When I try to connect using JDBC I am getting the following error, the database encoding is SQL_ASCII. Same error with postgresql-9.4-1201.jdbc4.jar & postgresql-9.1-902.jdbc4.jar. org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x92 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:305) at com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:567) Command used to create the database /usr/local/pgsql/bin/createdb --encoding=SQL_ASCII --template=template0 db_server Thanks, Prasanth
Prasanth Reddy wrote: > From log file: > ERROR: invalid byte sequence for encoding "UTF8": 0x92 > STATEMENT: SELECT * FROM client_data WHERE status_code = 0 ORDER BY > client_name, description > > Code that causes it: > String sql = "SELECT * FROM client_data WHERE status_code = 0 ORDER BY > client_name, description"; > ResultSet rs = connection.createStatement().executeQuery(sql); > * > *How do I set the connection property? String connectionString = "jdbc:postgresql://" + host + "/" + database + "?user=" + username + "&password=" + password + "&loglevel=" + logLevel; Connection dbConnection = DriverManager.getConnection(connectionString); Sample Test http://dandymadeproductions.com/temp/PostgreSQL_JDBC_Test.java danap.
Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Prasanth Reddy
Date:
Hi,
Below is the information I got when log level is set to 2. I removed the server name in the second line below.
Thanks,
Prasanth
12:42:02.356 (1) PostgreSQL 9.4 JDBC4 (build 1201)
12:42:02.377 (1) Trying to establish a protocol version 3 connection to xxxx.xxxxx.com:5432
12:42:02.451 (1) Receive Buffer Size is 43690
12:42:02.451 (1) Send Buffer Size is 9660
12:42:02.452 (1) FE=> StartupPacket(user=postgres, database=db_server, client_encoding=UTF8, DateStyle=ISO, TimeZone=US/Central, extra_float_digits=2)
12:42:02.458 (1) <=BE AuthenticationReqPassword
12:42:02.458 (1) FE=> Password(password=<not shown>)
12:42:02.492 (1) <=BE AuthenticationOk
12:42:02.505 (1) <=BE ParameterStatus(application_name = )
12:42:02.505 (1) <=BE ParameterStatus(client_encoding = UTF8)
12:42:02.505 (1) <=BE ParameterStatus(DateStyle = ISO, MDY)
12:42:02.505 (1) <=BE ParameterStatus(integer_datetimes = on)
12:42:02.506 (1) <=BE ParameterStatus(IntervalStyle = postgres)
12:42:02.506 (1) <=BE ParameterStatus(is_superuser = on)
12:42:02.506 (1) <=BE ParameterStatus(server_encoding = SQL_ASCII)
12:42:02.506 (1) <=BE ParameterStatus(server_version = 9.4.4)
12:42:02.506 (1) <=BE ParameterStatus(session_authorization = postgres)
12:42:02.506 (1) <=BE ParameterStatus(standard_conforming_strings = on)
12:42:02.506 (1) <=BE ParameterStatus(TimeZone = US/Central)
12:42:02.506 (1) <=BE BackendKeyData(pid=11101,ckey=124372759)
12:42:02.506 (1) <=BE ReadyForQuery(I)
12:42:02.510 (1) simple execute, handler=org.postgresql.core.SetupQueryRunner$SimpleResultHandler@106e68e, maxRows=0, fetchSize=0, flags=23
12:42:02.510 (1) FE=> Parse(stmt=null,query="SET extra_float_digits = 3",oids={})
12:42:02.525 (1) FE=> Bind(stmt=null,portal=null)
12:42:02.525 (1) FE=> Execute(portal=null,limit=1)
12:42:02.525 (1) FE=> Sync
12:42:02.575 (1) <=BE ParseComplete [null]
12:42:02.575 (1) <=BE BindComplete [null]
12:42:02.575 (1) <=BE CommandStatus(SET)
12:42:02.575 (1) <=BE ReadyForQuery(I)
12:42:02.576 (1) compatible = 90400
12:42:02.576 (1) loglevel = 2
12:42:02.576 (1) prepare threshold = 5
12:42:02.579 (1) types using binary send = TIMESTAMPTZ,UUID,INT2_ARRAY,INT4_ARRAY,BYTEA,TEXT_ARRAY,TIMETZ,INT8,INT2,INT4,VARCHAR_ARRAY,INT8_ARRAY,POINT,TIMESTAMP,TIME,BOX,FLOAT4,FLOAT8,FLOAT4_ARRAY,FLOAT8_ARRAY
12:42:02.580 (1) types using binary receive = TIMESTAMPTZ,UUID,INT2_ARRAY,INT4_ARRAY,BYTEA,TEXT_ARRAY,TIMETZ,INT8,INT2,INT4,VARCHAR_ARRAY,INT8_ARRAY,POINT,DATE,TIMESTAMP,TIME,BOX,FLOAT4,FLOAT8,FLOAT4_ARRAY,FLOAT8_ARRAY
12:42:02.580 (1) integer date/time = true
getConnection returning org.postgresql.Driver
12:42:02.616 (1) simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@1f38edc, maxRows=0, fetchSize=0, flags=17
12:42:02.617 (1) FE=> Parse(stmt=null,query="SELECT client_name, description, notes FROM client_data WHERE status_code = 0 ORDER BY client_name, description",oids={})
12:42:02.617 (1) FE=> Bind(stmt=null,portal=null)
12:42:02.617 (1) FE=> Describe(portal=null)
12:42:02.617 (1) FE=> Execute(portal=null,limit=0)
12:42:02.617 (1) FE=> Sync
12:42:02.685 (1) <=BE ParseComplete [null]
12:42:02.685 (1) <=BE BindComplete [null]
12:42:02.686 (1) <=BE RowDescription(3)
12:42:02.686 (1) Field(,VARCHAR,65535,T)
12:42:02.686 (1) Field(,VARCHAR,65535,T)
12:42:02.686 (1) Field(,TEXT,65535,T)
12:42:02.686 (1) <=BE DataRow(len=76)
12:42:02.686 (1) <=BE DataRow(len=139)
12:42:02.686 (1) <=BE DataRow(len=47)
12:42:02.686 (1) <=BE DataRow(len=563)
12:42:02.686 (1) <=BE DataRow(len=707)
12:42:02.686 (1) <=BE DataRow(len=21)
12:42:02.687 (1) <=BE DataRow(len=141)
12:42:02.687 (1) <=BE DataRow(len=448)
12:42:02.687 (1) <=BE DataRow(len=107)
12:42:02.687 (1) <=BE DataRow(len=108)
12:42:02.687 (1) <=BE DataRow(len=15)
12:42:02.687 (1) <=BE DataRow(len=328)
12:42:02.687 (1) <=BE DataRow(len=443)
12:42:02.687 (1) <=BE DataRow(len=28)
12:42:02.687 (1) <=BE DataRow(len=31)
12:42:02.687 (1) <=BE DataRow(len=36)
12:42:02.687 (1) <=BE DataRow(len=983)
12:42:02.687 (1) <=BE DataRow(len=914)
12:42:02.687 (1) <=BE DataRow(len=127)
12:42:02.687 (1) <=BE DataRow(len=95)
12:42:02.687 (1) <=BE DataRow(len=34)
12:42:02.687 (1) <=BE DataRow(len=160)
12:42:02.687 (1) <=BE DataRow(len=90)
12:42:02.687 (1) <=BE DataRow(len=33)
12:42:02.687 (1) <=BE DataRow(len=18)
12:42:02.687 (1) <=BE DataRow(len=71)
12:42:02.687 (1) <=BE DataRow(len=68)
12:42:02.688 (1) <=BE DataRow(len=37)
12:42:02.688 (1) <=BE DataRow(len=47)
12:42:02.688 (1) <=BE DataRow(len=52)
12:42:02.688 (1) <=BE DataRow(len=1145)
12:42:02.688 (1) <=BE DataRow(len=159)
12:42:02.688 (1) <=BE DataRow(len=136)
12:42:02.688 (1) <=BE DataRow(len=49)
12:42:02.688 (1) <=BE DataRow(len=22)
12:42:02.688 (1) <=BE DataRow(len=37)
12:42:02.688 (1) <=BE DataRow(len=120)
12:42:02.688 (1) <=BE DataRow(len=1296)
12:42:02.688 (1) <=BE DataRow(len=132)
12:42:02.688 (1) <=BE DataRow(len=317)
12:42:02.688 (1) <=BE DataRow(len=64)
12:42:02.688 (1) <=BE DataRow(len=87)
12:42:02.688 (1) <=BE DataRow(len=44)
12:42:02.688 (1) <=BE DataRow(len=33)
12:42:02.688 (1) <=BE DataRow(len=49)
12:42:02.688 (1) <=BE DataRow(len=1028)
12:42:02.688 (1) <=BE DataRow(len=41)
12:42:02.688 (1) <=BE DataRow(len=181)
12:42:02.689 (1) <=BE DataRow(len=229)
12:42:02.689 (1) <=BE DataRow(len=26)
12:42:02.689 (1) <=BE DataRow(len=224)
12:42:02.689 (1) <=BE DataRow(len=31)
12:42:02.689 (1) <=BE DataRow(len=190)
12:42:02.689 (1) <=BE DataRow(len=148)
12:42:02.689 (1) <=BE DataRow(len=258)
12:42:02.689 (1) <=BE DataRow(len=202)
12:42:02.689 (1) <=BE DataRow(len=133)
12:42:02.689 (1) <=BE DataRow(len=331)
12:42:02.689 (1) <=BE DataRow(len=116)
12:42:02.689 (1) <=BE DataRow(len=811)
12:42:02.689 (1) <=BE DataRow(len=26)
12:42:02.689 (1) <=BE DataRow(len=262)
12:42:02.689 (1) <=BE DataRow(len=27)
12:42:02.689 (1) <=BE DataRow(len=59)
12:42:02.689 (1) <=BE DataRow(len=150)
12:42:02.689 (1) <=BE DataRow(len=45)
12:42:02.689 (1) <=BE DataRow(len=30)
12:42:02.689 (1) <=BE DataRow(len=643)
12:42:02.689 (1) <=BE DataRow(len=66)
12:42:02.689 (1) <=BE DataRow(len=433)
12:42:02.690 (1) <=BE DataRow(len=1093)
12:42:02.690 (1) <=BE DataRow(len=103)
12:42:02.690 (1) <=BE DataRow(len=193)
12:42:02.690 (1) <=BE DataRow(len=197)
12:42:02.690 (1) <=BE DataRow(len=465)
12:42:02.690 (1) <=BE DataRow(len=226)
12:42:02.690 (1) <=BE DataRow(len=44)
12:42:02.690 (1) <=BE DataRow(len=69)
12:42:02.690 (1) <=BE DataRow(len=46)
12:42:02.690 (1) <=BE DataRow(len=48)
12:42:02.691 (1) <=BE DataRow(len=55)
12:42:02.691 (1) <=BE DataRow(len=19)
12:42:02.691 (1) <=BE DataRow(len=55)
12:42:02.691 (1) <=BE DataRow(len=25)
12:42:02.691 (1) <=BE DataRow(len=31)
12:42:02.691 (1) <=BE DataRow(len=37)
12:42:02.691 (1) <=BE DataRow(len=29)
12:42:02.691 (1) <=BE DataRow(len=399)
12:42:02.692 (1) <=BE DataRow(len=36)
12:42:02.692 (1) <=BE DataRow(len=334)
12:42:02.692 (1) <=BE DataRow(len=36)
12:42:02.692 (1) <=BE DataRow(len=26)
12:42:02.692 (1) <=BE DataRow(len=116)
12:42:02.692 (1) <=BE DataRow(len=1136)
12:42:02.692 (1) <=BE DataRow(len=29)
12:42:02.692 (1) <=BE DataRow(len=103)
12:42:02.692 (1) <=BE DataRow(len=92)
12:42:02.692 (1) <=BE DataRow(len=25)
12:42:02.692 (1) <=BE DataRow(len=22)
12:42:02.692 (1) <=BE DataRow(len=30)
12:42:02.692 (1) <=BE DataRow(len=113)
12:42:02.692 (1) <=BE DataRow(len=162)
12:42:02.692 (1) <=BE DataRow(len=30)
12:42:02.693 (1) <=BE DataRow(len=454)
12:42:02.693 (1) <=BE DataRow(len=24)
12:42:02.693 (1) <=BE DataRow(len=27)
12:42:02.693 (1) <=BE DataRow(len=953)
12:42:02.693 (1) <=BE DataRow(len=30)
12:42:02.693 (1) <=BE DataRow(len=37)
12:42:02.693 (1) <=BE DataRow(len=52)
12:42:02.693 (1) <=BE DataRow(len=19)
12:42:02.693 (1) <=BE DataRow(len=320)
12:42:02.693 (1) <=BE DataRow(len=174)
12:42:02.693 (1) <=BE DataRow(len=46)
12:42:02.693 (1) <=BE DataRow(len=42)
12:42:02.693 (1) <=BE DataRow(len=56)
12:42:02.693 (1) <=BE DataRow(len=159)
12:42:02.693 (1) <=BE DataRow(len=195)
12:42:02.694 (1) <=BE DataRow(len=57)
12:42:02.694 (1) <=BE DataRow(len=120)
12:42:02.694 (1) <=BE DataRow(len=41)
12:42:02.694 (1) <=BE DataRow(len=437)
12:42:02.694 (1) <=BE DataRow(len=98)
12:42:02.694 (1) <=BE DataRow(len=452)
12:42:02.694 (1) <=BE DataRow(len=84)
12:42:02.694 (1) <=BE DataRow(len=168)
12:42:02.694 (1) <=BE DataRow(len=37)
12:42:02.694 (1) <=BE DataRow(len=24)
12:42:02.694 (1) <=BE DataRow(len=58)
12:42:02.694 (1) <=BE DataRow(len=132)
12:42:02.694 (1) <=BE DataRow(len=48)
12:42:02.694 (1) <=BE DataRow(len=55)
12:42:02.695 (1) <=BE DataRow(len=35)
12:42:02.695 (1) <=BE DataRow(len=26)
12:42:02.695 (1) <=BE DataRow(len=123)
12:42:02.695 (1) <=BE DataRow(len=22)
12:42:02.695 (1) <=BE DataRow(len=25)
12:42:02.695 (1) <=BE DataRow(len=28)
12:42:02.695 (1) <=BE DataRow(len=332)
12:42:02.697 (1) <=BE DataRow(len=25)
12:42:02.697 (1) <=BE DataRow(len=342)
12:42:02.697 (1) <=BE DataRow(len=70)
12:42:02.697 (1) <=BE DataRow(len=29)
12:42:02.697 (1) <=BE DataRow(len=112)
12:42:02.697 (1) <=BE DataRow(len=24)
12:42:02.697 (1) <=BE DataRow(len=151)
12:42:02.697 (1) <=BE DataRow(len=26)
12:42:02.697 (1) <=BE DataRow(len=955)
12:42:02.697 (1) <=BE DataRow(len=33)
12:42:02.697 (1) <=BE DataRow(len=71)
12:42:02.698 (1) <=BE DataRow(len=46)
12:42:02.698 (1) <=BE DataRow(len=400)
12:42:02.698 (1) <=BE DataRow(len=268)
12:42:02.698 (1) <=BE DataRow(len=26)
12:42:02.698 (1) <=BE DataRow(len=347)
12:42:02.698 (1) <=BE DataRow(len=23)
12:42:02.698 (1) <=BE DataRow(len=248)
12:42:02.698 (1) <=BE DataRow(len=39)
12:42:02.698 (1) <=BE DataRow(len=22)
12:42:02.698 (1) <=BE DataRow(len=146)
12:42:02.698 (1) <=BE DataRow(len=1169)
12:42:02.698 (1) <=BE DataRow(len=93)
12:42:02.698 (1) <=BE DataRow(len=434)
12:42:02.698 (1) <=BE DataRow(len=77)
12:42:02.699 (1) <=BE DataRow(len=701)
12:42:02.699 (1) <=BE DataRow(len=62)
12:42:02.699 (1) <=BE DataRow(len=28)
12:42:02.699 (1) <=BE DataRow(len=532)
12:42:02.699 (1) <=BE DataRow(len=76)
12:42:02.699 (1) <=BE DataRow(len=184)
12:42:02.699 (1) <=BE DataRow(len=31)
12:42:02.699 (1) <=BE DataRow(len=42)
12:42:02.699 (1) <=BE DataRow(len=297)
12:42:02.699 (1) <=BE DataRow(len=73)
12:42:02.699 (1) <=BE DataRow(len=129)
12:42:02.699 (1) <=BE DataRow(len=28)
12:42:02.699 (1) <=BE DataRow(len=87)
12:42:02.699 (1) <=BE DataRow(len=117)
12:42:02.699 (1) <=BE DataRow(len=105)
12:42:02.700 (1) <=BE DataRow(len=111)
12:42:02.702 (1) <=BE DataRow(len=31)
12:42:02.702 (1) <=BE DataRow(len=52)
12:42:02.702 (1) <=BE DataRow(len=26)
12:42:02.703 (1) <=BE ErrorMessage(ERROR: invalid byte sequence for encoding "UTF8": 0x92)
org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x92
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:406)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:286)
at com.nqadmin.jGAS.Test.getClientData(Test.java:44)
at com.nqadmin.jGAS.Test.main(Test.java:26)
SQLException: SQLState(22021)
12:42:02.707 (1) <=BE ReadyForQuery(I)
Below is the information I got when log level is set to 2. I removed the server name in the second line below.
Thanks,
Prasanth
12:42:02.356 (1) PostgreSQL 9.4 JDBC4 (build 1201)
12:42:02.377 (1) Trying to establish a protocol version 3 connection to xxxx.xxxxx.com:5432
12:42:02.451 (1) Receive Buffer Size is 43690
12:42:02.451 (1) Send Buffer Size is 9660
12:42:02.452 (1) FE=> StartupPacket(user=postgres, database=db_server, client_encoding=UTF8, DateStyle=ISO, TimeZone=US/Central, extra_float_digits=2)
12:42:02.458 (1) <=BE AuthenticationReqPassword
12:42:02.458 (1) FE=> Password(password=<not shown>)
12:42:02.492 (1) <=BE AuthenticationOk
12:42:02.505 (1) <=BE ParameterStatus(application_name = )
12:42:02.505 (1) <=BE ParameterStatus(client_encoding = UTF8)
12:42:02.505 (1) <=BE ParameterStatus(DateStyle = ISO, MDY)
12:42:02.505 (1) <=BE ParameterStatus(integer_datetimes = on)
12:42:02.506 (1) <=BE ParameterStatus(IntervalStyle = postgres)
12:42:02.506 (1) <=BE ParameterStatus(is_superuser = on)
12:42:02.506 (1) <=BE ParameterStatus(server_encoding = SQL_ASCII)
12:42:02.506 (1) <=BE ParameterStatus(server_version = 9.4.4)
12:42:02.506 (1) <=BE ParameterStatus(session_authorization = postgres)
12:42:02.506 (1) <=BE ParameterStatus(standard_conforming_strings = on)
12:42:02.506 (1) <=BE ParameterStatus(TimeZone = US/Central)
12:42:02.506 (1) <=BE BackendKeyData(pid=11101,ckey=124372759)
12:42:02.506 (1) <=BE ReadyForQuery(I)
12:42:02.510 (1) simple execute, handler=org.postgresql.core.SetupQueryRunner$SimpleResultHandler@106e68e, maxRows=0, fetchSize=0, flags=23
12:42:02.510 (1) FE=> Parse(stmt=null,query="SET extra_float_digits = 3",oids={})
12:42:02.525 (1) FE=> Bind(stmt=null,portal=null)
12:42:02.525 (1) FE=> Execute(portal=null,limit=1)
12:42:02.525 (1) FE=> Sync
12:42:02.575 (1) <=BE ParseComplete [null]
12:42:02.575 (1) <=BE BindComplete [null]
12:42:02.575 (1) <=BE CommandStatus(SET)
12:42:02.575 (1) <=BE ReadyForQuery(I)
12:42:02.576 (1) compatible = 90400
12:42:02.576 (1) loglevel = 2
12:42:02.576 (1) prepare threshold = 5
12:42:02.579 (1) types using binary send = TIMESTAMPTZ,UUID,INT2_ARRAY,INT4_ARRAY,BYTEA,TEXT_ARRAY,TIMETZ,INT8,INT2,INT4,VARCHAR_ARRAY,INT8_ARRAY,POINT,TIMESTAMP,TIME,BOX,FLOAT4,FLOAT8,FLOAT4_ARRAY,FLOAT8_ARRAY
12:42:02.580 (1) types using binary receive = TIMESTAMPTZ,UUID,INT2_ARRAY,INT4_ARRAY,BYTEA,TEXT_ARRAY,TIMETZ,INT8,INT2,INT4,VARCHAR_ARRAY,INT8_ARRAY,POINT,DATE,TIMESTAMP,TIME,BOX,FLOAT4,FLOAT8,FLOAT4_ARRAY,FLOAT8_ARRAY
12:42:02.580 (1) integer date/time = true
getConnection returning org.postgresql.Driver
12:42:02.616 (1) simple execute, handler=org.postgresql.jdbc2.AbstractJdbc2Statement$StatementResultHandler@1f38edc, maxRows=0, fetchSize=0, flags=17
12:42:02.617 (1) FE=> Parse(stmt=null,query="SELECT client_name, description, notes FROM client_data WHERE status_code = 0 ORDER BY client_name, description",oids={})
12:42:02.617 (1) FE=> Bind(stmt=null,portal=null)
12:42:02.617 (1) FE=> Describe(portal=null)
12:42:02.617 (1) FE=> Execute(portal=null,limit=0)
12:42:02.617 (1) FE=> Sync
12:42:02.685 (1) <=BE ParseComplete [null]
12:42:02.685 (1) <=BE BindComplete [null]
12:42:02.686 (1) <=BE RowDescription(3)
12:42:02.686 (1) Field(,VARCHAR,65535,T)
12:42:02.686 (1) Field(,VARCHAR,65535,T)
12:42:02.686 (1) Field(,TEXT,65535,T)
12:42:02.686 (1) <=BE DataRow(len=76)
12:42:02.686 (1) <=BE DataRow(len=139)
12:42:02.686 (1) <=BE DataRow(len=47)
12:42:02.686 (1) <=BE DataRow(len=563)
12:42:02.686 (1) <=BE DataRow(len=707)
12:42:02.686 (1) <=BE DataRow(len=21)
12:42:02.687 (1) <=BE DataRow(len=141)
12:42:02.687 (1) <=BE DataRow(len=448)
12:42:02.687 (1) <=BE DataRow(len=107)
12:42:02.687 (1) <=BE DataRow(len=108)
12:42:02.687 (1) <=BE DataRow(len=15)
12:42:02.687 (1) <=BE DataRow(len=328)
12:42:02.687 (1) <=BE DataRow(len=443)
12:42:02.687 (1) <=BE DataRow(len=28)
12:42:02.687 (1) <=BE DataRow(len=31)
12:42:02.687 (1) <=BE DataRow(len=36)
12:42:02.687 (1) <=BE DataRow(len=983)
12:42:02.687 (1) <=BE DataRow(len=914)
12:42:02.687 (1) <=BE DataRow(len=127)
12:42:02.687 (1) <=BE DataRow(len=95)
12:42:02.687 (1) <=BE DataRow(len=34)
12:42:02.687 (1) <=BE DataRow(len=160)
12:42:02.687 (1) <=BE DataRow(len=90)
12:42:02.687 (1) <=BE DataRow(len=33)
12:42:02.687 (1) <=BE DataRow(len=18)
12:42:02.687 (1) <=BE DataRow(len=71)
12:42:02.687 (1) <=BE DataRow(len=68)
12:42:02.688 (1) <=BE DataRow(len=37)
12:42:02.688 (1) <=BE DataRow(len=47)
12:42:02.688 (1) <=BE DataRow(len=52)
12:42:02.688 (1) <=BE DataRow(len=1145)
12:42:02.688 (1) <=BE DataRow(len=159)
12:42:02.688 (1) <=BE DataRow(len=136)
12:42:02.688 (1) <=BE DataRow(len=49)
12:42:02.688 (1) <=BE DataRow(len=22)
12:42:02.688 (1) <=BE DataRow(len=37)
12:42:02.688 (1) <=BE DataRow(len=120)
12:42:02.688 (1) <=BE DataRow(len=1296)
12:42:02.688 (1) <=BE DataRow(len=132)
12:42:02.688 (1) <=BE DataRow(len=317)
12:42:02.688 (1) <=BE DataRow(len=64)
12:42:02.688 (1) <=BE DataRow(len=87)
12:42:02.688 (1) <=BE DataRow(len=44)
12:42:02.688 (1) <=BE DataRow(len=33)
12:42:02.688 (1) <=BE DataRow(len=49)
12:42:02.688 (1) <=BE DataRow(len=1028)
12:42:02.688 (1) <=BE DataRow(len=41)
12:42:02.688 (1) <=BE DataRow(len=181)
12:42:02.689 (1) <=BE DataRow(len=229)
12:42:02.689 (1) <=BE DataRow(len=26)
12:42:02.689 (1) <=BE DataRow(len=224)
12:42:02.689 (1) <=BE DataRow(len=31)
12:42:02.689 (1) <=BE DataRow(len=190)
12:42:02.689 (1) <=BE DataRow(len=148)
12:42:02.689 (1) <=BE DataRow(len=258)
12:42:02.689 (1) <=BE DataRow(len=202)
12:42:02.689 (1) <=BE DataRow(len=133)
12:42:02.689 (1) <=BE DataRow(len=331)
12:42:02.689 (1) <=BE DataRow(len=116)
12:42:02.689 (1) <=BE DataRow(len=811)
12:42:02.689 (1) <=BE DataRow(len=26)
12:42:02.689 (1) <=BE DataRow(len=262)
12:42:02.689 (1) <=BE DataRow(len=27)
12:42:02.689 (1) <=BE DataRow(len=59)
12:42:02.689 (1) <=BE DataRow(len=150)
12:42:02.689 (1) <=BE DataRow(len=45)
12:42:02.689 (1) <=BE DataRow(len=30)
12:42:02.689 (1) <=BE DataRow(len=643)
12:42:02.689 (1) <=BE DataRow(len=66)
12:42:02.689 (1) <=BE DataRow(len=433)
12:42:02.690 (1) <=BE DataRow(len=1093)
12:42:02.690 (1) <=BE DataRow(len=103)
12:42:02.690 (1) <=BE DataRow(len=193)
12:42:02.690 (1) <=BE DataRow(len=197)
12:42:02.690 (1) <=BE DataRow(len=465)
12:42:02.690 (1) <=BE DataRow(len=226)
12:42:02.690 (1) <=BE DataRow(len=44)
12:42:02.690 (1) <=BE DataRow(len=69)
12:42:02.690 (1) <=BE DataRow(len=46)
12:42:02.690 (1) <=BE DataRow(len=48)
12:42:02.691 (1) <=BE DataRow(len=55)
12:42:02.691 (1) <=BE DataRow(len=19)
12:42:02.691 (1) <=BE DataRow(len=55)
12:42:02.691 (1) <=BE DataRow(len=25)
12:42:02.691 (1) <=BE DataRow(len=31)
12:42:02.691 (1) <=BE DataRow(len=37)
12:42:02.691 (1) <=BE DataRow(len=29)
12:42:02.691 (1) <=BE DataRow(len=399)
12:42:02.692 (1) <=BE DataRow(len=36)
12:42:02.692 (1) <=BE DataRow(len=334)
12:42:02.692 (1) <=BE DataRow(len=36)
12:42:02.692 (1) <=BE DataRow(len=26)
12:42:02.692 (1) <=BE DataRow(len=116)
12:42:02.692 (1) <=BE DataRow(len=1136)
12:42:02.692 (1) <=BE DataRow(len=29)
12:42:02.692 (1) <=BE DataRow(len=103)
12:42:02.692 (1) <=BE DataRow(len=92)
12:42:02.692 (1) <=BE DataRow(len=25)
12:42:02.692 (1) <=BE DataRow(len=22)
12:42:02.692 (1) <=BE DataRow(len=30)
12:42:02.692 (1) <=BE DataRow(len=113)
12:42:02.692 (1) <=BE DataRow(len=162)
12:42:02.692 (1) <=BE DataRow(len=30)
12:42:02.693 (1) <=BE DataRow(len=454)
12:42:02.693 (1) <=BE DataRow(len=24)
12:42:02.693 (1) <=BE DataRow(len=27)
12:42:02.693 (1) <=BE DataRow(len=953)
12:42:02.693 (1) <=BE DataRow(len=30)
12:42:02.693 (1) <=BE DataRow(len=37)
12:42:02.693 (1) <=BE DataRow(len=52)
12:42:02.693 (1) <=BE DataRow(len=19)
12:42:02.693 (1) <=BE DataRow(len=320)
12:42:02.693 (1) <=BE DataRow(len=174)
12:42:02.693 (1) <=BE DataRow(len=46)
12:42:02.693 (1) <=BE DataRow(len=42)
12:42:02.693 (1) <=BE DataRow(len=56)
12:42:02.693 (1) <=BE DataRow(len=159)
12:42:02.693 (1) <=BE DataRow(len=195)
12:42:02.694 (1) <=BE DataRow(len=57)
12:42:02.694 (1) <=BE DataRow(len=120)
12:42:02.694 (1) <=BE DataRow(len=41)
12:42:02.694 (1) <=BE DataRow(len=437)
12:42:02.694 (1) <=BE DataRow(len=98)
12:42:02.694 (1) <=BE DataRow(len=452)
12:42:02.694 (1) <=BE DataRow(len=84)
12:42:02.694 (1) <=BE DataRow(len=168)
12:42:02.694 (1) <=BE DataRow(len=37)
12:42:02.694 (1) <=BE DataRow(len=24)
12:42:02.694 (1) <=BE DataRow(len=58)
12:42:02.694 (1) <=BE DataRow(len=132)
12:42:02.694 (1) <=BE DataRow(len=48)
12:42:02.694 (1) <=BE DataRow(len=55)
12:42:02.695 (1) <=BE DataRow(len=35)
12:42:02.695 (1) <=BE DataRow(len=26)
12:42:02.695 (1) <=BE DataRow(len=123)
12:42:02.695 (1) <=BE DataRow(len=22)
12:42:02.695 (1) <=BE DataRow(len=25)
12:42:02.695 (1) <=BE DataRow(len=28)
12:42:02.695 (1) <=BE DataRow(len=332)
12:42:02.697 (1) <=BE DataRow(len=25)
12:42:02.697 (1) <=BE DataRow(len=342)
12:42:02.697 (1) <=BE DataRow(len=70)
12:42:02.697 (1) <=BE DataRow(len=29)
12:42:02.697 (1) <=BE DataRow(len=112)
12:42:02.697 (1) <=BE DataRow(len=24)
12:42:02.697 (1) <=BE DataRow(len=151)
12:42:02.697 (1) <=BE DataRow(len=26)
12:42:02.697 (1) <=BE DataRow(len=955)
12:42:02.697 (1) <=BE DataRow(len=33)
12:42:02.697 (1) <=BE DataRow(len=71)
12:42:02.698 (1) <=BE DataRow(len=46)
12:42:02.698 (1) <=BE DataRow(len=400)
12:42:02.698 (1) <=BE DataRow(len=268)
12:42:02.698 (1) <=BE DataRow(len=26)
12:42:02.698 (1) <=BE DataRow(len=347)
12:42:02.698 (1) <=BE DataRow(len=23)
12:42:02.698 (1) <=BE DataRow(len=248)
12:42:02.698 (1) <=BE DataRow(len=39)
12:42:02.698 (1) <=BE DataRow(len=22)
12:42:02.698 (1) <=BE DataRow(len=146)
12:42:02.698 (1) <=BE DataRow(len=1169)
12:42:02.698 (1) <=BE DataRow(len=93)
12:42:02.698 (1) <=BE DataRow(len=434)
12:42:02.698 (1) <=BE DataRow(len=77)
12:42:02.699 (1) <=BE DataRow(len=701)
12:42:02.699 (1) <=BE DataRow(len=62)
12:42:02.699 (1) <=BE DataRow(len=28)
12:42:02.699 (1) <=BE DataRow(len=532)
12:42:02.699 (1) <=BE DataRow(len=76)
12:42:02.699 (1) <=BE DataRow(len=184)
12:42:02.699 (1) <=BE DataRow(len=31)
12:42:02.699 (1) <=BE DataRow(len=42)
12:42:02.699 (1) <=BE DataRow(len=297)
12:42:02.699 (1) <=BE DataRow(len=73)
12:42:02.699 (1) <=BE DataRow(len=129)
12:42:02.699 (1) <=BE DataRow(len=28)
12:42:02.699 (1) <=BE DataRow(len=87)
12:42:02.699 (1) <=BE DataRow(len=117)
12:42:02.699 (1) <=BE DataRow(len=105)
12:42:02.700 (1) <=BE DataRow(len=111)
12:42:02.702 (1) <=BE DataRow(len=31)
12:42:02.702 (1) <=BE DataRow(len=52)
12:42:02.702 (1) <=BE DataRow(len=26)
12:42:02.703 (1) <=BE ErrorMessage(ERROR: invalid byte sequence for encoding "UTF8": 0x92)
org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x92
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:406)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:286)
at com.nqadmin.jGAS.Test.getClientData(Test.java:44)
at com.nqadmin.jGAS.Test.main(Test.java:26)
SQLException: SQLState(22021)
12:42:02.707 (1) <=BE ReadyForQuery(I)
On 08/07/2015 11:25 PM, Prasanth Reddy wrote:
From log file:
ERROR: invalid byte sequence for encoding "UTF8": 0x92
STATEMENT: SELECT * FROM client_data WHERE status_code = 0 ORDER BY client_name, description
Code that causes it:
String sql = "SELECT * FROM client_data WHERE status_code = 0 ORDER BY client_name, description";
ResultSet rs = connection.createStatement().executeQuery(sql);
How do I set the connection property?
-------------------------------------------------------------
Can you share the query and parameters that reproduce the failure?
For instance, can you please set loglevel=2 connection property and
provide "FE=> Bind", "FE=> Describe", etc stdout messages that precede
"invalid byte sequence" error?
Vladimir
On 08/07/2015 11:38 AM, Prasanth Reddy wrote:Hi, I have recently migrated to 9.4.4 from 9.1. I did a dump and restore to migrate the database. When I try to connect using JDBC I am getting the following error, the database encoding is SQL_ASCII. Same error with postgresql-9.4-1201.jdbc4.jar & postgresql-9.1-902.jdbc4.jar. org.postgresql.util.PSQLException: ERROR: invalid byte sequence for encoding "UTF8": 0x92 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2270) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1998) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:570) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:420) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:305) at com.sun.rowset.JdbcRowSetImpl.execute(JdbcRowSetImpl.java:567) Command used to create the database /usr/local/pgsql/bin/createdb --encoding=SQL_ASCII --template=template0 db_server Thanks, Prasanth
Re: Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Bosco Rama
Date:
On 08/08/15 10:49, Prasanth Reddy wrote: > [snip] > 12:42:02.505 (1) <=BE ParameterStatus(client_encoding = UTF8) [snip] > 12:42:02.506 (1) <=BE ParameterStatus(server_encoding = SQL_ASCII) There's your problem. The client is expecting UTF8 while the server is storing un-vetted SQL_ASCII. You will need to change one of the components' choice of encoding and/or enforce content conformance in the data. Another choice, in cases of known and expected non-compliance, is to use bytea casting to bypass the automated content vetting. But your choice in this case is going to be driven by the ease with which you can alter your application vs the server-side changes that would be needed. HTH, Bosco.
Re: Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Vladimir Sitnikov
Date:
>The client is expecting UTF8 while the server is storing un-vetted SQL_ASCII. I thought server would reconvert it to client_encoding. Shouldn't it use client_encoding when sending data to the client? Vladimir
Re: Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
John R Pierce
Date:
On 8/8/2015 2:04 PM, Vladimir Sitnikov wrote: >> The client is expecting UTF8 while the server is storing un-vetted SQL_ASCII. > I thought server would reconvert it to client_encoding. > Shouldn't it use client_encoding when sending data to the client? > Vladimir SQL_ASCII means unknown encoding, bytes in, bytes out. you can't convert that to anything else as the system doesn't know what it is. -- john r pierce, recycling bits in santa cruz
Re: Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Vladimir Sitnikov
Date:
>SQL_ASCII means unknown encoding, bytes in, bytes out. This makes perfect sense now. Thanks. Vladimir
Re: Re: Postgresql 9.4.4 - ERROR: invalid byte sequence for encoding "UTF8": 0x92
From
Bosco Rama
Date:
On 08/08/15 14:04, Vladimir Sitnikov wrote: >> The client is expecting UTF8 while the server is storing un-vetted SQL_ASCII. > > I thought server would reconvert it to client_encoding. > Shouldn't it use client_encoding when sending data to the client? Yep. And it looks like something not UTF8 got put into that data item. Either from a restore, a server function or another client that was not using UTF8 as its encoding. HTH, Bosco.