0

I'm using a very old software written probably in VB6 which is discontinued since years. This software is using SQL Server 2005 database. My goal was to use this database inside my PHP application.
The problem is characters encoding. Database's encoding is Polish_CI_AS according to Microsoft SQL Server Management Studio. This could be either WINDOWS-1250 or CP1250 or ISO-8859-2 according to my understanding. The rows are nvarchar type

Now this is what I see when I use SQL Server Management Studio enter image description here

This is obviously broken, it should be:
Nom: Markowska -Kwestionariusz(+)
Prenom: Magdalena
Tel3: I don't want to post it but numbers are mixed up in the DB

However this VB6 software displays those values properly and that is biggest mystery to me here. It's weird that NATIVE SQL Server Management Studio displays it incorrectly in first place. In PHP I tried to use iconv() to convert it to UTF-8 but without success. I tried those 3 character encoding types mentioned above, result was the same. I am connecting using PDO+ODBC, tried all 3 encoding methods. All failed.

Did anyone experience anything similar or perhaps this mystery glyph [] at the beginning of each row's value looks similar? Also that whitespace replaced with currency character ¤ and all this followed by wrong characters order?

Thanks in advance for any tips and suggestions :)

Mike
  • 842
  • 1
  • 9
  • 31
  • Does your SQL Server Management Studio application itself support this encoding? In other words is this just a display issue when using this tool (and the data in teh DB is totally fine.) – Mike Brant Oct 04 '13 at 17:09
  • Can it not support it? That would be very awkward. SQL Management studio is not 200KB application but hundred megabytes powerful software which should support any encoding that it's database (SQL 2005) use. I tried to play with nvarchar binary conversions but I always ended up with same results :( – Mike Oct 04 '13 at 17:17
  • Also one more thing. Lets assume it doesn't support this encoding. That doesn't explain incorrect characters order. – Mike Oct 04 '13 at 17:19
  • Just because an applicaotin is big doesn;t mean it has all possible language packs, etc. installed with it. For using Windows itself, if you want to work with certain character sets (Japenese, Chinese, etc.) you have to install language packs which are typically not installed by default. I don't use SQL server at all, but just in looking at your comments as to the software displaying thing correctly, it would led my to question the tool being used to view the database. – Mike Brant Oct 04 '13 at 17:22
  • 2
    Do you have access to the VB source code? If it is displaying the information correctly it would be very useful to know what it is doing that Management Studio is not. Perhaps it is very loose custom obfuscation that obviously Microsoft isn't going to have coded into their own applications. – Aaron Bertrand Oct 04 '13 at 17:40
  • @AaronBertrand I really wish I had. My knowledge of rev. eng. is very poor but eventually this may be the only way to solve this problem. – Mike Oct 04 '13 at 17:42

0 Answers0