List:General Discussion« Previous MessageNext Message »
From:Jim Winstead Date:July 2 2004 9:19pm
Subject:Re: Display of "?" and Hex conversion
View as plain text  
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
Thread
Foreign Key on text fieldSudip Shekhawat9 Jun
  • EJB - Entity BeansBoyd E. Hemphill10 Jun
    • RE: EJB - Entity BeansJon Frisby10 Jun
      • Display of "?" and Hex conversionBoyd E. Hemphill2 Jul
        • Re: Display of "?" and Hex conversionJim Winstead2 Jul
          • Tuning InnoDB situationBoyd E. Hemphill13 Aug
            • Re: Tuning InnoDB situationWare Adams13 Aug
RE: Tuning InnoDB situationVictor Pendleton13 Aug