Thread: Re: idea for reading encodign format
-----Original Message-----
From: frank_lupo [mailto:frank_lupo@email.it]
Sent: 11 September 2002 07:12
To: Dave Page
Cc: pgadmin-hackers
Subject: RE: [pgadmin-hackers] idea for reading encodign formatIs possible that the problem the vesrione of the compiler?My version 7.2 is compiled by GCC 2.95.3-5Your version 7.2 is compiled by GCC egcs-2.91.66Is a problem ?OK, any ideas on the problem I mentioned?-----Original Message-----
From: frank_lupo [mailto:frank_lupo@email.it]
Sent: 10 September! 200 2 16:34
To: Dave Page
Cc: pgadmin-hackers
Subject: Re: [pgadmin-hackers] idea for reading encodign format
I using PostgreSQL 7.2
template1=# select version();
version
------------------------------------------------------------
PostgreSQL 7.2 on i686-pc-cygwin, compiled by GCC 2.95.3-5
(1 row)
I tried on 2 &nbs! p;systems :
template1=# select versin();
version
---------------! --------- - -------------------------------------
PostgreSQL 7.3b1 on i686-pc-cygwin, compiled by GCC 2.95.3-5
(1 row)template1=# select ! &nb s p; pg_encoding_to_char(0)
template1-# union select pg_encoding_to_char(1)
template1-# union select pg_encoding_to_char(2)
template1-# union select pg_encoding_to_char(3)
template1-# union select pg_encoding_to_char(4)
template1-# union select pg_encoding_to_char(5)
template1-# union select pg_encoding_to_char(6)
template1-# union select pg_encoding_to_char(7)
template1-# union select pg_encoding_to_char(8)
template1-# union select pg_encoding_to_char(9)
template1-# union select pg_en! coding_t! & nbsp;o_char(10 )
template1-# union select pg_encoding_to_char(11)
template1-# union select pg_encoding_to_char(12)
template1-# union select pg_encoding_to_char(13)
template1-# union select pg_encoding_to_char(14)
template1-# union select pg_encoding_to_char(15)
template1-# union select pg_encoding_to_char(16)
template1-# union select pg_encoding_to_char(17)
template1-# union select pg_encoding_to_char(18)
template1-# union select pg_encoding_to_char(19)
template1-# union select pg_en! coding_to _ char(20)
template1-# union select pg_encoding_to_char(21);
pg_encoding_to_char
---------------------
EUC_CN
EUC_JP
EUC_KR
EUC_TW
JOHAB
KOI8
LATIN1
LATIN10
LATIN2
LATIN3
LATIN4
LA! TIN5
& n bsp;LATIN6
LATIN7
LATIN8
LATIN9
MULE_INTERNAL
SQL_ASCII
TCVN
UNICODE
WIN1256
WIN874
(22 rows)andtemplate1=> select version();
version
-------------------------------------------------------------------
PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
(1! ro w )template1=> select pg_encoding_to_char(0)
template! 1->&nb s p;union select pg_encoding_to_char(1)
template1-> union select pg_encoding_to_char(2)
template1-> union select pg_encoding_to_char(3)
template1-> union select pg_encoding_to_char(4)
template1-> union select pg_encoding_to_char(5)
template1-> union select pg_encoding_to_char(6)
template1-> union select pg_encoding_to_char(7)
template1-> union select pg_encoding_to_char(8)
template1-> union select pg_encoding_to_char(9)
template1-> union select pg_encoding_to_char(10)
templa! te1->& n bsp;union select pg_encoding_to_char(11)
template1-> union select&nb! sp; pg_en c oding_to_char(12)
template1-> union select pg_encoding_to_char(13)
template1-> union select pg_encoding_to_char(14)
template1-> union select pg_encoding_to_char(15)
template1-> union select pg_encoding_to_char(16)
template1-> union select pg_encoding_to_char(17)
template1-> union select pg_encoding_to_char(18)
template1-> union select pg_encoding_to_char(19)
template1-> union select ! ;pg_encod i ng_to_char(20)
template1-> union select pg_encoding_to_char(21);
pg_encoding_to_char
---------------------
SQL_ASCII
(1 row)The 7.2 system was ! ; compile d without multibyte support. In 7.3, multibyte is always on. I guess it probably doesn't matter much as it's obviously giving only useful encodings, the problem is this (on the 7.2&! nbsp;syst e m):template1=> select pg_encoding_to_char(45);
pg_encoding_to_char
---------------------
SQL_ASCII
(1 row)template1=> select pg_encoding_to_char(450);0 D
pg_encoding_to_char
---------------------
SQL_ASCII
(1 row)How would the loop know when to give up and exit?Regards, Dave.-----Original Message-----
From: frank_lupo [mailto:frank_lupo@email.it]
Sent: 10 September 2002 14:45
To: Dave Page
! Cc: pgadmin-hackers
Subject: RE: [pgadmin-hackers] idea for reading encodign format
I replace this code in frmdatabase pgadmin2. I don't have this problem. &nb! sp; 0D
What is your result if you execute this selection ?
select
pg_encoding_to_char(0)union select pg_encoding_to_char(1)
union select pg_encoding_to_char(2)
union select & nbsp; pg_encoding_to_char(3)
unio! n select pg_encoding_to_char(4)
union select pg_encoding_to_char(5)
union select pg_encoding_to_char(6)
union select pg_encoding_to_char(7)
union select pg_encoding_to_char(8) union&n b sp;select pg_encoding_to_char(9)
union
select pg_encoding_to_char(10)union
select pg_encoding_to_char(11)union
select pg_encoding_to_char(12)union
select pg_encoding_to_char(13) &nb! sp; < P>union select pg_encoding_to_char(14)
union
select pg_encoding_to_char(15)union
select pg_encod! ing_to_ch a r(16)union
select pg_encoding_to_char(17)union
select pg_encodin! g_to_char ( 18)union
select pg_encoding_to_char(19)union
select pg_encoding_to_char(20)union select pg_encoding_to_char(21)
My result is :
pg_encoding_to_char
---------------------
ALT
EUC_CN
EUC_JP
EUC_KR
EUC_TW
ISO_8859_5
ISO_8859_6
KOI8
LATIN1 L ATIN10
LATIN2
&n! bsp;LATIN 3
LATIN4
LATIN5
LATIN6
LATIN7
LATIN8
LATIN9
MULE_INTERNAL
&! nbsp;SQL_ A SCII
UNICODE
WIN
(22 rows)The order is not by number encoding.
Hi Frank,&n! bsp; ;Hmm, that doesn't seem to work here. For any random integervalue of X &nb! sp; & nbsp;that I try in select pg_encoding_to_char(X), I get SQL_ASCII as the result.This is a problem I would like to fix, though I don't have time myself right now :-(Regards, Dave.< / DIV>-----Original Message-----
From: frank_lupo [mailto:frank_lupo@email.it]
Sent: 09 September 2002 16:46
To: pgadmin-hackers
Subject: [pgadmin-hackers] idea ! ; & n bsp;for reading encodign format
&! nbsp;&nbs p ;for reading e! ncodign&n b sp;format current version is:
'Load the Encoding Schemes
cboProperties(0).Text = "SQL_ASCII"
Set objItem = &n! bsp;cboPr o perties(0).ComboItems.Add(, , "SQL_ASCII", "encoding", "encoding")
objItem.Selected = True
&n! bsp; ;
cboProperties(0).ComboItems.Add , , "EUC_JP", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "EUC_CN", "e! ncoding", & ! ; & n bsp; nbsp;"encoding"
cboProperties(0).ComboItems.Add , , "EUC_KR", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "EUC_TW", "encoding", "encoding"
cboProperties(0).ComboItems.Add , ! &nb s ! p;, " UNICODE", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "MULE_INTERNAL", "encoding", "encoding"< BR> ; cboProperties(0).ComboItems.Add , , "LATIN1", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "LATIN2", "encoding", ! ; &n b sp; "encoding"
cboProperties(0).ComboItems.Add , , "LATIN3", &nb! sp; " encoding", "encoding"
cbo! Propertie s (0).ComboItems.Add , , "LATIN4", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "LATIN5", "encoding", ! ; &n b sp; "encoding"
cboProperties(0).ComboItems.Add , , "KOI8", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "WIN", "encoding", "encoding"
cboProperties(0).ComboItems.Add , , "ALT", "encoding", "encoding" ! ; &n b sp;this version is a problem to custom encodign into program. For new encodign modify program to add new &n! bsp;encod i gn
For reading automatly encodign usign thi! s co d e : < /P>
Dim rsSQL As New Recordset
Dim bIsValid As Boolean &nbs! p; & n bsp;'Load the ! ; &n b sp; Encoding Schemes
bIsValid = True
X = 0
While bIsValid
Set rsSQL = frmMain.svr.Databases("template1").Execute("select pg_encoding_to_char(" & X & ")")
If ! ; & n bsp; &n! bsp;rsSQL . Fields(0).Value = "" T! hen b IsValid = False
If bIsValid Then
If X = 0 &nbs! p; & n bsp; Then
cboProperties(0).Text = rsSQL.Fields(0).Value
&nbs Bye !! Frank Lupo (Wolf) !!----
Prendi GRATIS l'email universale che... risparmia: clicca qui
Sponsor:
Sconti fino al 20% per i magnifici bouquet di Artefiori! Clicca qui!
Clicca qui