Skip to Content.
Sympa Menu

freetds - RE: [freetds] DB Connectivity & Character set Problem while connectingto MSSQL 7.0 server from Linux via PHP using FreeTDS

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: <viswanathan.natarajan AT patni.com>, "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Cc:
  • Subject: RE: [freetds] DB Connectivity & Character set Problem while connectingto MSSQL 7.0 server from Linux via PHP using FreeTDS
  • Date: Mon, 18 Oct 2004 11:19:04 +0200

>
> Hi,
>
>
> I am facing a problem with regards to DB connectivity using
> FreeTDS. I
> checked the log freetds.log and I think
> The problem is because of the character set that is returned
> by MSSQL not
> being recognized by freeTDS .
> The connection to Database works and returns a valid handle but while
> querying the Database using this handle,
> I get the following error.
>
> Warning: mssql_query() [function.mssql-query]: WARNING! Some
> character(s)
> could not be converted into client's character set.
> Unconverted bytes were
> changed to question marks ('?'). (severity 16)
>

It's not an error but a warning.

> I am using MSSQL 7.0 and trying to connect to it via freetds
> version 8.0
> form a Linux box running PHP.
>
> My FreeTDS.conf looks like this
>
>
>
> NAS - freetds.conf

...
>
> [cbsidbdv1corpge]
> host = cbsidbdv1corpge.corporate.ge.com
> port = 1433
> tds version = 8.0
>

You don't set client charset, default it's iso8859-1.

...
>
>
> when i run sp_helpsort on DB host I get the following o/p
>
> Unicode data sorting
> ----------------------
> Locale ID = 1033
>
> case insensitive, kana type insensitive, width insensitive
>
>
> Sort Order Description
> --------------------------------------------------------------
> --------------
> --------------------------------------------------------
> Character Set = 2, cp850
> Code Page 850 (Multilingual) character set.
> Sort Order = 42, nocase_850
> Case-insensitive dictionary sort order for use with several We
> stern-European languages including English, French, and German
> . Uses the Code Page 850 character set.
>
> Characters, in Order
> --------------------------------------------------------------
> --------------
> --------------------------------------------------------
> ! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | }
> ~  £ × ƒ ª º ¿ ® ¬ ½ ¼ ¡ « » ¦ ¦ ¦ ¦ ¦ © ¦ ¦ + + ¢ ¥ + + - - +
> - + + + - - ¦ - + ¤ + + ¦ _ ¦ ¯ µ ¯ ´ ­ ± = ¾ ¶ § ÷ ¸ ° ¨ · ¹ ³
> ² ¦ 0 1 2 3 4 5 6 7 8 9 A=a à=À á=Á â=Â ã=Ã ä=Ä å=Å æ=Æ B=b C
> =c Ç=ç D=d E=e è=È é=É ê=Ê ë=Ë F=f G=g H=h I=i ì=Ì í=Í î=Î ï=Ï i
> J=j K=k L=l M=m N=n ñ=Ñ O=o ò=Ò ó=Ó ô=Ô õ=Õ ö=Ö ø=Ø P=p Q=q R=r
> S=s ß T=t U=u ù=Ù ú=Ú û=Û ü=Ü V=v W=w X=x Y=y ý=Ý ÿ Z=z ð=Ð þ=Þ
>
> appreciate any help on this.
>

Simply iso8859-1 can't represent all cp850 characters so FreeTDS complaints
about. You can ignore warning and handle possible corrupted conversions or
change client charset. You are using PHP so I think you output web pages. My
suggestion in this case it's to use utf-8. This charset can represent any
present and ancient language (even characters not possible on mssql) and it's
supported by all browsers.

freddy77



Archive powered by MHonArc 2.6.24.

Top of Page