Skip to Content.
Sympa Menu

freetds - Re: [freetds] Problems executing a query

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Problems executing a query
  • Date: Fri, 17 Jun 2005 19:14:58 +0200

Il giorno ven, 17-06-2005 alle 18:01 +0200, Riccardo Penco ha scritto:
> ZIGLIO, Frediano, VF-IT ha scritto:
> >
> > The problem is the editor. From my machine
> >
> > $ cat test.php
> > <?php
> >
> > echo 'Città';
> >
> > ?>
> >
> > $ hexdump -C < test.php
> > 00000000 3c 3f 70 68 70 20 0a 0a 65 63 68 6f 20 27 43 69 |<?php ..echo
> > 'Ci|
> > 00000010 74 74 c3 a0 27 3b 0a 0a 3f 3e 0a 0a |tt..';..?>..|
> > 0000001c
> > $
> >
> > Note that 'à' is encoded as 0xc3 0xa0, not 0xe0.
> >
> but in the php script the à is encoded as 0xe0.
>
> from the hexdump:
> 45 52 20 42 59 20 43 69 74 74 e0 3c 62 72 20 2f |ER BY Citt.<br /|
>
> I also noticed that if I comment out in /etc/freetds.com:
^^^ conf
> ;client charset = UTF-8
> than the script works correctly.
>

It works without "client charset = UTF-8" cause you are not using an
UTF-8 client... Here you have 3 entities:
- PHP script
- FreeTDS
- client (I think (x)html/xml)
For best results you have to use the same encoding. If your script is
encoded in iso8859-1 and you configured FreeTDS to receive UTF-8 it will
interpret your strings in UTF-8 while they are iso8859-1... I don't know
which editor you used to edit your PHP but it's not producing an UTF-8
encoded file so strings in your script are not UTF-8 encoded. Removing
"client charset = UTF-8" works cause FreeTDS default is iso8859-1 where
0xe0 means 'à' but if you configure FreeTDS to receive UTF-8 0xe0 is an
invalid character. Remember also that FreeTDS return data on same
encoding so if you decide to use iso8859-1 (or whichever encoding your
editor use) you must tell client that output is encoded in that way (or
you have to recode all output). Also consider your database encoding.
Your database is encoded in windows-1252 (also called CP1252). If your
data is varchar you cannot store characters not coded in this encoding.
Probably in this case "client charset = WINDOWS-1252" is what you want.
iso8859-1 don't encode euro symbol while iso8859-15 or windows-1252
does.

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page