0

I have problem with cyrillic characters. Here is image that shows how i have setup everything https://i.stack.imgur.com/UHssn.jpg . As you can see everything is as UTF-8, but still cyrillic characters come out from server as questionmark diamonds. I used mb_detect_encoding -function and it said that those diamonds are as UTF-8 encoding.

When i run then through bin2hex, it gives this:

1100 - cccdcec3ced1cbcec9cdc0df20cac5d0c0ccc8cac0
1200 - d2cecbd1d2cecfcbc5cdced7cdc0df20cac5d0c0ccc8cac0
1300 - c1cecdc4c8cdc32fcdc0cdc5d1c5cdc8c520ddcfcecad1c8c4cac8 
1400 - d3d1d2c0cdcec2cac020cad0c8d1d2c0cbcbcec2
1500 - d3d1d2c0cdcec2cac020cfd0cec2cec4cec2
1600 - c1cecdc4c8cdc32fc8cdcac0cfd1d3cbdfd6c8df

And the problem is ONLY with data that comes out from MSSQL server. Other cyrillic language data that comes from php lang files shows right. What could be causing this?

Johan
  • 74,508
  • 24
  • 191
  • 319
Jammae
  • 49
  • 2
  • 11

2 Answers2

0

I would suggest you to change the collation to utf_bin and try once. and put this line on top of your page:

<?=header('Content-Type: text/html; charset=UTF-8');?>
Nil'z
  • 7,487
  • 1
  • 18
  • 28
  • What do you mean by "utf_bin" collation? Cause i can't find that. Server collation: http://technet.microsoft.com/en-us/library/ms180175.aspx Windows collation: http://technet.microsoft.com/en-us/library/ms188046.aspx And i tried to set charset in header, but it didn't solve this problem. But thanks for your help so far. – Jammae Sep 30 '13 at 08:56
  • See this link : http://stackoverflow.com/questions/12512687/sql-server-utf8-howto – Nil'z Sep 30 '13 at 09:25
  • I tried all kind of settings, but situation is always same. Sometimes text shows up as basic questionmarks and sometimes as diamond questionmarks. I thought that if it is UTF-16 and tried to convert UTF-16 -> UTF-8 with iconv but no. Here is image of my current settings -> http://i.imgur.com/bmHox0d.jpg I haven't had any kind of problems with MySQL server cause you can find straight UTF-8 encoding, but some reason this MsSQL is quite a challenge. – Jammae Sep 30 '13 at 12:03
0

I found the solution from other stackoverflow question!

In /etc/freetds/freetds.conf , had to add those two lines.

[global]
tds version = 8.0
client charset = UTF-8

And now nchar and nvarchar datatypes shows cyrillic right!

Jammae
  • 49
  • 2
  • 11