Unicode conversion for MySQL and JSON

I have HTML that was inserted into a MySQL database from a CSV file, which in turn was exported from an access MDB file. The MDB file was exported as Unicode and is indeed Unicode. However, I'm not sure how the MySQL database coding is.

When I try to output html stored in a field but Unicode doesn't exist. This is a direct search for one of the html fields in the database.

http://www.yousendit.com/download/TTZueEVYQzMrV3hMWEE9PQ

The source indicates utf-8

. The actual page code generated by the echo article_desc

is located here:

http://www.nomorepasting.com/getpaste.php?pasteid=22566

I need to use this html with JSON and I am wondering what I should be doing. I cannot use other frameworks or libraries. Should I transform the data before inserting it into the MySQL DB or something else?

0


source to share


1 answer


The mdb file was exported as Unicode and is indeed unocode.

This makes no sense. The file cannot be unicode. It can be encoded with a unicode compatible encoding like utf-8 or utf-16 or utf-8 with a BOM or ..



Encoding problems are a very common problem and have their root in ignorance. I am not saying this to offend you, but you really need to know the difference between code points (strings) and encodings (bytestreams). If you don't know who you are dealing with at any time throughout your application, you will end up in trouble eventually. The curse about these problems is that they only happen in extreme cases, so it's easy to monitor them for a long time, and when you finally realize that something is wrong, it could be launched in a completely unrelated part of your application. ... This makes debugging impossible.

+2


source







All Articles