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

Viswanathan viswanathan.natarajan at patni.com
Tue Oct 19 12:01:03 EDT 2004


Hi Freddy,

Thanks the char set problem is resolved once I made the entry for
UTF-8 in freetds.conf file. now I am able to connect to BD and query the DB.

Thanks
Viswa

-----Original Message-----
From: ZIGLIO, Frediano, VF-IT [mailto:Frediano.Ziglio at vodafone.com]
Sent: Monday, October 18, 2004 2:49 PM
To: viswanathan.natarajan at patni.com; FreeTDS Development Group
Subject: RE: [freetds] DB Connectivity & Character set Problem while
connectingto MSSQL 7.0 server from Linux via PHP using FreeTDS


> 
> 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

------------------------------------------------------------------------------------------------------------------------
Disclaimer: This e-mail message along with attachment, contain Patni GE Confidential, proprietary & legally privileged information for the sole use of the person or entity to whom this message was originally addressed. Any review, e-transmission dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you have received this e-mail in error kindly delete this e-mail from your records. If it appears that this mail has been forwarded to you without proper authority, please notify the sender and delete this mail. This email (in whole or in part) is not to be reproduced or furnished to third parties or made public without the prior express written permission of the sender.
------------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3484 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20041019/26b19d73/winmail.bin


More information about the FreeTDS mailing list