Posgresql to MSsql encoding problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi All,
I have this PHP script that simply dumps (inserts) data from a
Postgresql server to a customer's M$SQL server.
The database in the PGSQL server is UTF-8 encoded where the M$SQL
database uses LATIN1.
Accents, as expected, turn to gibberish... :(
I cannot simply use "Set Client Encoding to LATIN1" as the "client"
itself is the script ... :)
Is there a simple way to circumvent this?
Already thankful for any info,
Best regards,
Pedro Doria Meunier
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkrPEukACgkQ2FH5GXCfxAv9LwCeIsLcr7wwcBTzvXqM/ufYysUK
yQ8AniNYuAjQAEktUt7OCS7lZl4kz92f
=qBrj
-----END PGP SIGNATURE-----
On Fri, Oct 9, 2009 at 6:39 AM, Pedro Doria Meunier
<pdoria@netmadeira.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hi All,
I have this PHP script that simply dumps (inserts) data from a
Postgresql server to a customer's M$SQL server.The database in the PGSQL server is UTF-8 encoded where the M$SQL
database uses LATIN1.
why can't you set the client encoding? php should be able to handle
latin1 and send it to mssql right? if you can't do it automatically
there is always iconv.
merlin
On Fri, Oct 09, 2009 at 11:39:47AM +0100, Pedro Doria Meunier wrote:
I cannot simply use "Set Client Encoding to LATIN1" as the "client"
itself is the script ... :)
What does this mean? surely if it's just a "script" you can put another
line at the beginning of the script that says this?
If you really can't do this, how about using ALTER USER to change the
the user that they use latin1 by default?
--
Sam http://samason.me.uk/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Sam,
Thanks for your answer! :)
The matter of fact is that the script itself is the connected client
where the postgresql server is concerned.
It then connects to another server (the M$SQL one) and, on a row
basis, inserts data coming from the aforementioned connection...
So, to all effects, the script is *the* client... :)
Best regards,
Pedro Doria Meunier
On 10/09/2009 02:38 PM, Sam Mason wrote:
On Fri, Oct 09, 2009 at 11:39:47AM +0100, Pedro Doria Meunier
wrote:I cannot simply use "Set Client Encoding to LATIN1" as the
"client" itself is the script ... :)What does this mean? surely if it's just a "script" you can put
another line at the beginning of the script that says this?If you really can't do this, how about using ALTER USER to change
the the user that they use latin1 by default?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iEYEARECAAYFAkrPTYQACgkQ2FH5GXCfxAvzSQCfV1tdIq3NSQVN0O8gNfQS1Iok
wxMAoIyGe2pQeWz4k3HSaeIEOaT4r49G
=/gqA
-----END PGP SIGNATURE-----
On Fri, Oct 9, 2009 at 8:49 AM, Pedro Doria Meunier
<pdoria@netmadeira.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hi Sam,
Thanks for your answer! :)The matter of fact is that the script itself is the connected client
where the postgresql server is concerned.It then connects to another server (the M$SQL one) and, on a row
basis, inserts data coming from the aforementioned connection...So, to all effects, the script is *the* client... :)
It's a php script, right? Just issue a pg_query("set client encoding
yadayada;") at the beginning.
On Friday 9. October 2009, Scott Marlowe wrote:
On Fri, Oct 9, 2009 at 8:49 AM, Pedro Doria Meunier
<pdoria@netmadeira.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Hi Sam,
Thanks for your answer! :)The matter of fact is that the script itself is the connected client
where the postgresql server is concerned.It then connects to another server (the M$SQL one) and, on a row
basis, inserts data coming from the aforementioned connection...So, to all effects, the script is *the* client... :)
It's a php script, right? Just issue a pg_query("set client encoding
yadayada;") at the beginning.
PHP even has a special function for it:
pg_set_client_encoding($db, LATIN1);
--
Leif Biberg Kristensen | Registered Linux User #338009
Me And My Database: http://solumslekt.org/blog/