freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Frediano Ziglio <freddy77 AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Unicode problem
- Date: Tue, 3 Sep 2013 13:45:04 +0200
How did you configure odbc.ini ?
Try to add ClientCharset (see
http://www.freetds.org/userguide/odbcconnattr.htm)
Frediano
2013/9/3 Vano Beridze <vano.beridze AT silkroad.ge>
> Hello,
>
> I've got windows 7 machine that runs SQL Server Express 2008 R2.
> I've some table with nvarchar field that contains unicode data.
>
> Another linux (CentOS 6.4) machine runs Apache 2.2 with php 5.3.3.
> freetds version is 0.91
>
> This is the /etc/freetds.conf file
> [global]
> # TDS protocol version
> tds version = 8.0
> port = 1433
> client charset = UTF-8
> # Whether to write a TDSDUMP file for diagnostic purposes
> # (setting this to /tmp is insecure on a multi-user system)
> dump file = /tmp/freetds.log
> debug flags = 0x4fff
>
> # Command and connection timeouts
> timeout = 180
> connect timeout = 180
>
> # If you get out-of-memory errors, it may mean that your client
> # is trying to allocate a huge buffer for a TEXT field.
> # Try setting 'text size' to a more reasonable limit
> text size = 20971520
>
> I've created simple php script that connects to sql server and reads
> data from that table (actually there is a view to hide unnecessary fields)
>
> Here is the php script
> <?php
> echo "<html><head>";
> echo '<meta http-equiv="Content-type" content="text/html; charset=utf-8"
> />';
> echo "</head>";
> echo "<body>";
> echo "<h1>Hello</h1>";
> $connect = odbc_connect("server", "someuser", "somepass");
>
> if (!$connect) {
> echo '<h3 color="red">Could not connect to the database!!!</h3>';
> die();
> }
>
>
> # query the users table for all fields
> $query = "SELECT odf_address FROM dbo.odf";
>
> # perform the query
> $result = odbc_exec($connect, $query);
>
> # fetch the data from the database
> while(odbc_fetch_row($result)) {
> #$field1 = odbc_result($result, 1);
> $field2 = odbc_result($result, 1);
> #echo $field1;
> #echo "<br>";
> echo $field2;
> echo "<br>";
> }
>
> # close the connection
> odbc_close($connect);
> echo "</body></html>";
> ?>
>
> The script works fine. it connects and gets the data. The only problem I
> have is that data is shown as question marks, so it's not converted to
> UTF-8. I've read all the information I could find on the internet but
> can not solve the problem.
>
> Could you please suggest what's the problem?
>
> --
> Vano Beridze
> Software Developer
> Silk Road Group
>
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
-
[freetds] Unicode problem,
Vano Beridze, 09/03/2013
-
Re: [freetds] Unicode problem,
Frediano Ziglio, 09/03/2013
-
Re: [freetds] Unicode problem,
Vano Beridze, 09/03/2013
- Re: [freetds] Unicode problem, Vano Beridze, 09/03/2013
-
Re: [freetds] Unicode problem,
Vano Beridze, 09/03/2013
-
Re: [freetds] Unicode problem,
James K. Lowden, 09/04/2013
-
Re: [freetds] Unicode problem,
Vano Beridze, 09/09/2013
-
Re: [freetds] Unicode problem,
James K. Lowden, 09/09/2013
- Re: [freetds] Unicode problem, Vano Beridze, 09/14/2013
-
Re: [freetds] Unicode problem,
James K. Lowden, 09/09/2013
-
Re: [freetds] Unicode problem,
Vano Beridze, 09/09/2013
- <Possible follow-up(s)>
- [freetds] Unicode problem, Vano Beridze, 09/03/2013
-
Re: [freetds] Unicode problem,
Frediano Ziglio, 09/03/2013
Archive powered by MHonArc 2.6.24.