Recent

Author Topic: How to charset Encoding SQL_ASCII To UTF8?  (Read 4518 times)

tongchimlang

  • Newbie
  • Posts: 4
How to charset Encoding SQL_ASCII To UTF8?
« on: March 24, 2016, 07:40:13 am »
hello, i want to ask about  charset .

PostgreSQL  Encoding :SQL_ASCII

i just connecting to my Postgres db and
i got my varchar field showing weird characters in my dbgrid
also try to change my grid font charset to Encoding but nothing happened

sorry if my english weird .

(please take a look my attachment)

Zoran

  • Hero Member
  • *****
  • Posts: 1592
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #1 on: March 24, 2016, 09:21:15 am »
I don't use postgres, but maybe you set your client encoding wrong - see the PQConnection component's property CharSet in object inspector.

What did you put to CharSet property of PQConnection?
Set it to UTF-8 and try then.
It should be UTF-8. The property tells to server what the client encoding is, which is always UTF-8 in LCL. It is mistake is to put the server encoding in this property.

tongchimlang

  • Newbie
  • Posts: 4
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #2 on: March 24, 2016, 10:47:42 am »
Set in to UTF-8 and UTF8 Not work.

LacaK

  • Hero Member
  • *****
  • Posts: 605
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #3 on: March 28, 2016, 06:56:33 pm »
UTF8 should work.
In your screenshots seems results to be same ... at least something should change if you set right char set.
What is your Lazarus version ? Can you try 1.6 ?

tongchimlang

  • Newbie
  • Posts: 4
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #4 on: March 29, 2016, 09:01:06 am »
Lazarus version 1.6

tongchimlang

  • Newbie
  • Posts: 4
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #5 on: April 29, 2016, 10:25:44 am »
help me please..
Thank.  :-\

zeljko

  • Hero Member
  • *****
  • Posts: 1149
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #6 on: April 29, 2016, 10:54:20 am »
if client_encoding is UTF-8 then it should work, not sure what happens if server is SQL_ASCII.

Can you exec query via PQ component: SHOW client_encoding; ?

What's result of
SELECT datname,encoding,datcollate,datctype FROM pg_database; ?
What's postgresql version ?

zeljko

  • Hero Member
  • *****
  • Posts: 1149
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: How to charset Encoding SQL_ASCII To UTF8?
« Reply #7 on: April 29, 2016, 10:57:23 am »
NO, if server encoding is SQL_ASCII then you're out of luck.
The SQL_ASCII setting behaves considerably differently from the other settings. When the server character set is SQL_ASCII, the server interprets byte values 0-127 according to the ASCII standard, while byte values 128-255 are taken as uninterpreted characters. No encoding conversion will be done when the setting is SQL_ASCII. Thus, this setting is not so much a declaration that a specific encoding is in use, as a declaration of ignorance about the encoding. In most cases, if you are working with any non-ASCII data, it is unwise to use the SQL_ASCII setting because PostgreSQL will be unable to help you by converting or validating non-ASCII characters.

http://www.postgresql.org/docs/9.4/static/multibyte.html

 

TinyPortal © 2005-2018