What I'm trying to do is saving UTF-8 text to MSSQL db with PHP.
I know that MSSQL is not so cool with UTF-8. But I get strange results.
In SQL Server Management Studio (SSMS) I open edit table data screen and insert Cyrillic and Arabic characters into a field. They seem to be saved correctly. It takes one byte per character. I view it on SSMS just fine, but when I pull it from PHP it gives gibberish.
In PHP I use INSERT syntax to save the same data as above. It saves fine and when I select it back, it prints correct UTF-8 data just as it was inserted. But this time it looks gibberish on SSMS. And takes two bytes per character.
My Question: Is this normal? Is this what all people get with PHP + MSSQL + UTF-8? Shall I swallow the fact that it takes two bytes per character, unreadable via SSMS... This is correct?
Screenshot
- First row was inserted via PHP. Reads fine from PHP, gibberish to SSMS.
- Second row was inserted via SSMS. Prints gibberish when selected by PHP.