Thread: ERROR: invalid byte sequence from psql - Works perfectly from pgAdmin III query window

ERROR: invalid byte sequence from psql - Works perfectly from pgAdmin III query window

From
"Anoo Sivadasan Pillai"
Date:

Why the Fun_ABC1 is created and Fun_ABC12 is raising the following error, while run through psql, ( I Could create both the functions from PgAdmin III query )

 

ERROR:  invalid byte sequence for encoding "UTF8": 0x93

HINT:  This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding".

 

CREATE OR REPLACE FUNCTION "Fun_ABC1"() RETURNS VOID AS

$BODY$

/***Description   :  "Desc1" – Description contains character  ***/

 

CREATE OR REPLACE FUNCTION "Fun_ABC12"() RETURNS VOID AS

$BODY$

/***Description   :  “Desc1”  – Description contains character ***/

 

Note : This was posted in pg_hackers/ As per the suggestions now reposting in general

 

 

 

Visit our Website at www.rmesi.co.in

This message is confidential. You should not copy it or disclose its contents to anyone. You may use and apply the information for the intended purpose only. Internet communications are not secure; therefore, RMESI does not accept legal responsibility for the contents of this message. Any views or opinions presented are those of the author only and not of RMESI. If this email has come to you in error, please delete it, along with any attachments. Please note that RMESI may intercept incoming and outgoing email communications.

Freedom of Information Act 2000
This email and any attachments may contain confidential information belonging to RMESI. Where the email and any attachments do contain information of a confidential nature, including without limitation information relating to trade secrets, special terms or prices these shall be deemed for the purpose of the Freedom of Information Act 2000 as information provided in confidence by RMESI and the disclosure of which would be prejudicial to RMESI's commercial interests.

This email has been scanned for viruses by Trend ScanMail.

Anoo Sivadasan Pillai wrote:
> Why the Fun_ABC1 is created and Fun_ABC12 is raising the following
> error, while run through psql, ( I Could create both the functions from
> PgAdmin III query )
>
> ERROR:  invalid byte sequence for encoding "UTF8": 0x93
>
> HINT:  This error can also happen if the byte sequence does not match
> the encoding expected by the server, which is controlled by
> "client_encoding".

Check your "client_encoding" setting in psql perhaps?

Presumably the text-file contains non-UTF8 characters but the
client_encoding says UTF8. Copying+pasting into pgAdmin is probably
translating for you.

--
   Richard Huxton
   Archonet Ltd

Anoo Sivadasan Pillai wrote:
> Why the Fun_ABC1 is created and Fun_ABC12 is raising the
> following error, while run through psql, ( I Could create
> both the functions from PgAdmin III query )
>
> ERROR:  invalid byte sequence for encoding "UTF8": 0x93

Because the characters you entered into psql are not
encoded in the character encoding that psql expects.

You probably create the function in psql by executing an
SQL script, right?

From the error message I deduce that psql expects UTF8
characters from you.

You can do two things:
1) change the SQL script to UTF8 before running it
2) change the client encoding in psql before running the
   SQL script.
   This is done with the SQL command
   SET client_encoding='...'

Yours,
Laurenz Albe

Albe Laurenz skrev:
> Anoo Sivadasan Pillai wrote:
>> Why the Fun_ABC1 is created and Fun_ABC12 is raising the
>> following error, while run through psql, ( I Could create
>> both the functions from PgAdmin III query )
>>
>> ERROR:  invalid byte sequence for encoding "UTF8": 0x93
>
> Because the characters you entered into psql are not
> encoded in the character encoding that psql expects.
>
> You probably create the function in psql by executing an
> SQL script, right?
>
> From the error message I deduce that psql expects UTF8
> characters from you.
>
> You can do two things:
> 1) change the SQL script to UTF8 before running it
> 2) change the client encoding in psql before running the
>    SQL script.
>    This is done with the SQL command
>    SET client_encoding='...'

Third option: Stop using curly quotes in your SQL - even if it just in
comments.

Nis