I used not only the PHP functions but also the native MySQL HEX() function to see exactly what was going into my database.
You can also set always_populate_raw_post_data = On in php.ini and examine $HTTP_RAW_POST_DATA to see exactly what the web server is seeing. Regards, Jerry Schwartz The Infoshop by Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 www.the-infoshop.com www.giiexpress.com www.etudes-marche.com >-----Original Message----- >From: Warren Young [mailto:[EMAIL PROTECTED] >Sent: Tuesday, May 13, 2008 8:53 AM >To: MySQL List >Subject: Re: latin1 vs UTF-8 > >Waynn Lue wrote: >> >> I'm getting a weird ^A character when I >> try to print it out in a textarea field. > >In that case, what character set does the browser think it should be >using for the page? If you don't explicitly declare it, the browser has >to guess, and you know what happens when you rely on a stupid computer >to do thinking a human should have done instead. > >You can either declare it for all pages on a site in your web server >configuration (gets sent with HTTP headers), in the equivalent <meta> >tag, or in an <?xml> tag if you're using XHTML. > >> I'm trying to figure out if >> there's some weird interaction between htmlentities that's causing it >> to be displayed strangely. > >To debug problems like this, I recommend studying hex dumps of the >relevant data at every stage along the path: > >1. echo 'query' | mysql --user=fred --password=barney mydb | hexdump > >2. write hex dump of query results to PHP debug log > >3. packet capture of HTTP reply containing finished page > >4. in browser, save web page to disk, and run through hexdump tool > >You'll find that a) the data isn't stored correctly in the database; or >b) it's being translated to another character set along the way (it >happens!); or c) the browser is misinterpreting it because you didn't >tell it what it needs to know to display it correctly. > > > Can I trust that mysql is displaying the >> text correctly on the command line tool if I have 4.1, even if the >> charset is set to latin1? > >Unless you're on a very old or strangely configured system, your >terminal is probably configured for UTF-8. Since your DB is in Latin-1, >there's a character set translation in there, and I can't confidently >predict what will happen. > >In this modern world, it's best to use some form of Unicode everywhere >possible. Then the worst you have to deal with is conversion among >encodings, which is annoying but lossless. > >-- >MySQL General Mailing List >For list archives: http://lists.mysql.com/mysql >To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] >infoshop.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]