Solved

MySQL Database Charset

Posted on 2009-04-03
10
493 Views
Last Modified: 2012-05-06
I have a mysql database and the data is stored as UTF-8.  This works fine for the primary site using it (blog), but I'm also make remote calls to the database from ASP website.  When doing this, I get bad characters back from the database.

For example, curly apostrophes and mdashes are stored in mysql as UTF-8 unicode, but when calling the data remotely, I get back garbled characters when doing response.write()

I have changed the response.charset to UTF-8 as well as ISO ... but neither works.

Any ideas?
0
Comment
Question by:golfDoctor
  • 7
  • 3
10 Comments
 
LVL 29

Expert Comment

by:Michael W
ID: 24060176
See if this helps...

Decode and Encode UTF-8
http://www.codetoad.com/asp_utf8.asp
0
 
LVL 16

Author Comment

by:golfDoctor
ID: 24060962
Not sure that's going to handle it.  For example, mdash is stored like this in the mySQL database: â¬
0
 
LVL 29

Expert Comment

by:Michael W
ID: 24061217
I am not an ASP programmer, but your ASP environment is going to have to encode and decode the UTF-8 character set when sending and retrieving from the MySQL database.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 16

Author Comment

by:golfDoctor
ID: 24061788
Maybe this is clearer example.  What I said prior was a bit off.  I can read the database from mySQL fine, and it does response.write OK.  However, I'm taking that data out of mySQL and storing in SQL Server.  The data then is stored in SQL Server, and viewing in SQL Server it shows â¬.
â¬

Open in new window

0
 
LVL 16

Author Comment

by:golfDoctor
ID: 24061793
When posting to EE, the characters don't render as they show in DB either :)
0
 
LVL 16

Author Comment

by:golfDoctor
ID: 24061816
This is the HTMLEncode that results from the mdash in mySQL.  â€”
0
 
LVL 29

Assisted Solution

by:Michael W
Michael W earned 100 total points
ID: 24061886
0
 
LVL 16

Author Comment

by:golfDoctor
ID: 24061923
Yes, I saw SET NAMES before, but didn't want to screw up the DB.  Maybe I'll give it a shot.
0
 
LVL 16

Author Comment

by:golfDoctor
ID: 24062101
I don't feel like messing with SET NAME and possibly screwing up the database.  

I fixed my issue though.  The problem was moving data directly from mySQL to SQL Server.   I made an intermediate page to response.write all the necessary data to the page, which does display the correct data, and then scraped that with XMLHTTP to add it to the SQL Server database.

A bit crude, but it works.
0
 
LVL 16

Accepted Solution

by:
golfDoctor earned 0 total points
ID: 24115677
No solutions, other than my intermediate page.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

18 Experts available now in Live!

Get 1:1 Help Now