• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 532
  • Last Modified:

MySQL Database Charset

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
golfDoctor
Asked:
golfDoctor
  • 7
  • 3
2 Solutions
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
See if this helps...

Decode and Encode UTF-8
http://www.codetoad.com/asp_utf8.asp
0
 
golfDoctorAuthor Commented:
Not sure that's going to handle it.  For example, mdash is stored like this in the mySQL database: â¬
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
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
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
golfDoctorAuthor Commented:
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
 
golfDoctorAuthor Commented:
When posting to EE, the characters don't render as they show in DB either :)
0
 
golfDoctorAuthor Commented:
This is the HTMLEncode that results from the mdash in mySQL.  â€”
0
 
Michael WorshamInfrastructure / Solutions ArchitectCommented:
0
 
golfDoctorAuthor Commented:
Yes, I saw SET NAMES before, but didn't want to screw up the DB.  Maybe I'll give it a shot.
0
 
golfDoctorAuthor Commented:
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
 
golfDoctorAuthor Commented:
No solutions, other than my intermediate page.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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