OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Display of "?" and Hex conversion

From: Jim Winstead (jimwmysql.com)
Date: Fri Jul 02 2004 - 14:19:43 CDT


On Fri, Jul 02, 2004 at 01:52:06PM -0500, Boyd E. Hemphill wrote:
> We discovered a rather odd situation where some space characters where
> being displayed as "?".
>
> In tracking this down, it was determined that the server had stored the
> hex value "A0" rather than "20" by using this query:

'A0' is the code for a non-breaking space, assuming you're using the
iso-8859-1 (or related) character encoding.

> update Location
> set NameLn = replace(hex(NameLn), 'A0' , '20')
> where hex(NameLn) like '%A0%'

Better would have been:

 UPDATE Location
    SET NameLn = REPLACE(NameLn, CHAR(0xA0), ' ')
  WHERE NameLn LIKE CONCAT('%',CHAR(0xA0),'%')

> Now for the NameLn field I have the hex string (arrrrrrg my data has
> been hexed!!! :-)
>
> So, my questions are:
> 1. How do I go back from the hex string to characters?

You can use the UNHEX() function.

> 2. Has anyone else seen this problem? At this point I can say the
> diplay issue only appears on some browsers.

The likely culprit for this sort of thing, in my experience, is users
using cut-and-paste from an application like Microsoft Word into their
browser. That often introduces similar issues with characters like
curly-quotes and em-dashes.

Jim Winstead
MySQL AB

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql