Recent

Author Topic: symbol €  (Read 3452 times)

joviali

  • New Member
  • *
  • Posts: 15
symbol €
« on: August 30, 2018, 10:40:29 am »
Hello, with the tzconection component I am attacking a fierebird database.
In the properties field, I have:
controls_cp = CP_UTF8
codepage = ISO8859_1
Dialect = 1
hard_commit = yes
AutoEncodeStrings = ON


In this way I could show the caratares: áéíóú ÄË .....

But with the symbol € if I do a sowmessage (tzsq.fielbyname ('description_symbol'). Asstring) I get a weird carater.
How can I visualize it?

BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: symbol €
« Reply #1 on: August 30, 2018, 10:51:20 am »
instead of
codepage = ISO8859_1
maybe
codepage = ISO8859_15



joviali

  • New Member
  • *
  • Posts: 15
Re: symbol €
« Reply #2 on: August 30, 2018, 01:38:47 pm »
codepage = ISO8859_15


Thanks, but it does not work.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11453
  • FPC developer.
Re: symbol €
« Reply #3 on: August 30, 2018, 01:48:17 pm »
Is the database really in ISO? Otherwise codepage is utf8 might help.

Soner

  • Sr. Member
  • ****
  • Posts: 305
Re: symbol €
« Reply #4 on: August 30, 2018, 01:57:17 pm »
Which Database? It looks like your are using firebird.
Also important how do you create the field.

1. Create the database with utf8:
Code: MySQL  [Select][+][-]
  1. CREATE DATABASE mydatabase
  2.   DEFAULT CHARACTER SET UTF8
  3. ...
  4.  

2. use for  string fields utf8:
Code: MySQL  [Select][+][-]
  1.  description_symbol VARCHAR(10) CHARACTER SET UTF8, -- also important for case-insensitive search: COLLATE UNICODE_CI,
  2. ..
  3.  

Look here for firebird: http://www.destructor.de/firebird/charsets.htm

BrunoK

  • Sr. Member
  • ****
  • Posts: 452
  • Retired programmer
Re: symbol €
« Reply #5 on: August 30, 2018, 03:26:27 pm »
Try to detect the CodePoint used in the .AsString.

Put this function somewhere in your code
Code: Pascal  [Select][+][-]
  1. function DumpString(aString : string) : String;
  2. var
  3.   aByteBuf :array of byte absolute aString;
  4.   ix : integer;
  5. begin
  6.   Result := '';
  7.   for ix:= 0 to Length(aString)-1 do
  8.     if ix=0 then
  9.       Result:='['+IntToHex(aByteBuf[ix], 2)
  10.     else
  11.       Result:=Result+' '+IntToHex(aByteBuf[ix], 2);
  12.   Result:=Result+']'
  13. end;
then watch in the Inspect window the result of
Code: Pascal  [Select][+][-]
  1. var
  2.   lFieldDump : String;
  3.   ...
  4. begin
  5.   ...
  6.   lFieldDump:=DumpString(tzsq.fielbyname ('description_symbol'). AsString);
  7.   ... // <- place a break point here and look value of lFieldDump.
  8.       //    if the sequence 'E2 82 AC' appears your field in the table is UTF-8.
  9.       //    If you find a '80' you are probably in CP1252
  10.       //    If you find '20 AC' it is UCS-2
  11.       //    If you find 'A4' it is ISO/CEI 8859-15
  12. end;


joviali

  • New Member
  • *
  • Posts: 15
Re: symbol €
« Reply #6 on: August 30, 2018, 06:57:32 pm »
Hi, Brunok.

Quote
ff

I have tried the function
Code: Pascal  [Select][+][-]
  1. lFieldDump:=DumpString(tzsq.fielbyname ('description_symbol'). AsString);
  2.  
  3. // <- place a break point here and look value of lFieldDump.
  4.  

and the result is:[C2 80]


that CodePoint is?


joviali

  • New Member
  • *
  • Posts: 15
Re: symbol €
« Reply #7 on: August 31, 2018, 12:09:10 pm »
 
Encoding
Character stuff
Named entity   not applicable
Alt code   not applicable
String stuff
HTML/XML
numeric entities   All but basic alphanumeric encoded (hexadecimal and decimal):
&#x80;
&#128;
UTF8 bytestring   as hex: c280
(UTF8 bytestring length is 2)
URL-encoded UTF8   %C2%80
Python string
before py3k   Unicode string:
  u'\x80'
UTF8 bytestring:
  '\xc2\x80'
...in py3k   Unicode string:
  '\x80'
UTF8 bytestring:
  b'\xc2\x80'
Javascript (≥1.3)   "\u0080"
LaTeX
(incomplete experiment)   nothing interesting to report here
Encodings that can encode this properly   utf_8   utf_16   latin_1   iso8859_2   iso8859_3   iso8859_4   iso8859_5   iso8859_6   iso8859_7   iso8859_8   iso8859_9   iso8859_10   iso8859_13   iso8859_14   iso8859_15   gb18030   cp037   cp424   cp500   cp875   cp932   cp1006   cp1026   cp1140
Encodings that will hurt your data   ascii   iso2022_jp   iso2022_jp_1   iso2022_jp_2   iso2022_jp_2004   iso2022_jp_3   iso2022_jp_ext   iso2022_kr   gb2312   gbk   big5   big5hkscs   euc_jp   euc_jis_2004   euc_jisx0213   euc_kr   hz   johab   koi8_r   koi8_u   mac_cyrillic   mac_greek   mac_iceland   mac_latin2   mac_roman   mac_turkish   ptcp154   shift_jis   shift_jis_2004   shift_jisx0213   cp437   cp737   cp775   cp850   cp852   cp855   cp856   cp857   cp860   cp861   cp862   cp863   cp864   cp865   cp866   cp869   cp874   cp949   cp950   cp1250   cp1251   cp1252   cp1253   cp1254   cp1255   cp1256   cp1257   cp1258

 

TinyPortal © 2005-2018