Solved

IIS and MySQL Cyrillic Problem

Posted on 2006-11-10
9
556 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:pravetz
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed with points refunded (50)

Computer101
EE Admin
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now