Solved

MySQL Database Charset

Posted on 2009-04-03
10
475 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
Comment Utility
See if this helps...

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

Author Comment

by:golfDoctor
Comment Utility
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
Comment Utility
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
 
LVL 16

Author Comment

by:golfDoctor
Comment Utility
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
Comment Utility
When posting to EE, the characters don't render as they show in DB either :)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 16

Author Comment

by:golfDoctor
Comment Utility
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
Comment Utility
0
 
LVL 16

Author Comment

by:golfDoctor
Comment Utility
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
Comment Utility
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
Comment Utility
No solutions, other than my intermediate page.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

728 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

12 Experts available now in Live!

Get 1:1 Help Now