You are here: Strange character encoding problem in MSSQL (Command-line vs. web access) « PHP SQL « IT news, forums, messages
Strange character encoding problem in MSSQL (Command-line vs. web access)

Posted by Kimmo Laine on 03/08/06 15:44

Hello group


I'm hoping someone could explain to me what is happening with MSSQL and
character encoding. First of all the thing is that the data I'm using has a
few special scandinavian characters: a with ring, a with dots, o with dots,
plus the euro currency symbol. Now, when I pull the data from MSSQL database
in normal webpage, the characters are encoded in ISO-8859-1 (Latin 1). But
when I run the same php script from the command line, suddenly the data from
the database is encoded like MS-DOS Codepage 850. This messes up the
scandinavic characters and I need to convert them back like so:
$line = str_replace(
array(chr(143),chr(142),chr(153),chr(134),chr(132),chr(148),chr(95)),
array(chr(197),chr(196),chr(214),chr(229),chr(228),chr(246),chr(128)),
$line
);

I'm looking for a solution that would not require me to replace single
characters one-by-one, but would change the character encoding mssql uses
for the data. And also an explanation of why this is happening. Any kind of
help will be appreciated.

PS. Using Win2003 Server, IIS6, PHP 5.0.5

Cheers

--
"En ole paha ihminen, mutta omenat ovat elinkeinoni." -Perttu Sirviφ
spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация