Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 595
  • Last Modified:

IIS and MySQL Cyrillic Problem

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
pravetz
Asked:
pravetz
  • 3
  • 3
1 Solution
 
VoteyDiscipleCommented:
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
 
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?
0
 
VoteyDiscipleCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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.
0
 
VoteyDiscipleCommented:
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
 
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.
0
 
Computer101Commented:
PAQed with points refunded (50)

Computer101
EE Admin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now