[freetds] client Czech charset name unrecognized

Daniel Fazekas fdsubs at t-online.hu
Fri Jul 15 08:36:40 EDT 2005


On Jul 15, 2005, at 13:27, Milan Vobecky wrote:

Since you say that...

> I test connection with tsql and all is OK. But when I test connection
> through php I can't obtain data.

...this usually points to a problem with freetds unable to read its  
configuration file when run under php/apache.
For example you tried tsql as root which had no problem accessing the  
configuration file, while the user account apache runs as isn't  
allowed to enter the config directory and read the file.

Another surprisingly common occurrence on this list is having people  
end up with multiple copies of FreeTDS on their system, each  
configured with a different prefix, thus expecting the freetds.conf  
file in a different place.

As a first step in finding the culprit, I always recommend in these  
cases to get Apache out of the picture and make sure you got it to  
work with the command line (cli SAPI) version of php first.

Try running from your shell:
TDSDUMP=stdout TDSDUMPCONFIG=stdout php /path/to/your/php/script.php

>         client charset = CP852
> //data in sybase have charset cp852
> [...]
>   <meta http-equiv="Content-Type" content="text/html;  
> charset=windows-1250">

And I think you also got a slight misunderstanding on what the client  
charset parameter is for, although this is unrelated to your current  
problem, it might become one in the future.

The client charset setting tells FreeTDS what the data coming from  
your program is in and what encoding should is use for data returned  
from the server, before sending it back to your program.

It is not a setting to tell FreeTDS what encoding the server uses.  
The server should know that and tell FreeTDS on its own, if it keeps  
that encoding for use during the TDS conversation at all. I don't  
really know about Sybase servers.

Either way, the client charset is used to tell FreeTDS what your  
program as the client wishes to use, unrelated to what encoding the  
server uses. So if you want to serve pages in windows-1250, that's  
what you should be specifying as the client charset.
Your only limitation is that you should be using an encoding which is  
either a superset of the server encoding or entirely compatible with  
it, so any character which could be represented in the server's  
encoding could be translated to your client.


Finally, you are trying to use a rather old version of FreeTDS. You  
might want to consider updating it to the latest stable version.

--
fds


More information about the FreeTDS mailing list