IIS and MySQL Cyrillic Problem

Win 2003 Server - regional settings English(US)
MySQL Default CharSet: cp1251

Using ASP to pull out and insert records in the DB. Im trying to work with Cyrillic but no luck. Seems like nothing is working for me. I tried:
<%@ CodePage=1251 %>
And I'm keeping this meta-tag at all times:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
but still the records are added and read wrong. I either get "?????????" or bunch ot messed up chars for my record.

Now if I change the server's regional settings it would work fine!
However I don't feel this is the right decision (What if that was a public web server hosting hundreds of sites with different languages!). I googled for hours on this and still nothing.
Please help!
What is the general practice for working with Cyrillic content under IIS/MySQL.

Who is Participating?
PAQed with points refunded (50)

EE Admin
The first thought that comes to mind is to run, as a SQL query,  'SET NAMES cp1251' after connecting (indicating that you wish to communicate with MySQL in cp1251 -- a decision that's entirely independent of how data are actually stored in your tables).
pravetzAuthor Commented:
Ok after trying all kinds of combinations here's where I got to:

<%@ CodePage=1251 %>
Response.CodePage = 0
Response.CharSet = "cp1251"

And "Stmt=SET NAMES 'cp1251'" in the MySQL query

Records are adding correctly and Reading correctly. However when I try to use Server.HTMLEncode() on them I get garbage like - ôñäôäñô

Any idea?
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

So if you output data directly to the page (i.e. without calling Server.HTMLEncode()) it shows up correctly, but once you do Server.HTMLEncode() it gets screwed up?  Do only special characters get screwed up (i.e. a single é becomes ôñäôäñô or something) or do all characters suddenly go nuts?
pravetzAuthor Commented:
Yes If I output the text without calling Server.HTMLEncode() text displays OK. Once I use Server.HTMLEncode() ALL of my chars get screwed, text becomes totally unreadable.
My best guess is that Sever.HTMLEncode() doesn't know what encoding your original data were, but I don't know how you might correct that.  Setting Response.CharSet seems like it ought to do it, but I haven't worked with character encodings in ASP before so I don't actually know.
pravetzAuthor Commented:
Googled on Sever.HTMLEncode() a lot but nobody seems to have my problem. I think the key is in the fact that if I switch "Regional Settings" of the server to my language all works fine. I hope that's not my only option.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.