Solved

IIS and MySQL Cyrillic Problem

Posted on 2006-11-10
9
568 Views
Last Modified: 2008-01-16
Running:
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.

0
Comment
Question by:pravetz
  • 3
  • 3
9 Comments
 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 17919816
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).
0
 

Author Comment

by:pravetz
ID: 17924006
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?
0
 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 17925625
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?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:pravetz
ID: 17926786
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.
0
 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 17926887
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.
0
 

Author Comment

by:pravetz
ID: 17927207
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.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18127059
PAQed with points refunded (50)

Computer101
EE Admin
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question