Print

Print


So, character encodings are really confusing, even for those who have 
dealt with them before. I'm not sure if there is a good 'dealing with 
character encodings for dummies' book, but if there is, I think I could 
use it too!

But from your case, I can say:    Ideally your source records are in a 
_known_ character set.  Either they are in a format where it's 
documented somewhere that that format is always in, or they are in a 
format that specifies exactly what the encoding is. You didn't mention 
exactly where your data is coming from.

For instance, MARC data is (legally) always in either UTF-8 or MARC-8.  
And there's a byte somewhere in the MARC header that specifies which one.

Assuming that's byte is set properly.  If you really don't have any 
'metadata' specifying what character encoding your data is in, and you 
have to guess from the data itself... that's not good. There's no 
foolproof way to do this, it's going to rely on heuristics. So you'd 
probably want to first narrow down a set of possibilities it could be 
encoded in, and then look around on the web for heuristic algorithms to 
try and guess from among that set.

Or you could just try assuming everything is UTF-8, and see if it 
works.  Your examples look like they _could_ be UTF-8, hard to say.

Because once you do figure out what everything is, I can recommend with 
confidence that what you want to do is translate EVERYTHING into UTF-8 
in your database.  Try to do all UTF-8 all the time, and it will save 
you a world of headaches. And once you know what something is, you 
should be able to find a tool to translate it to UTF-8.

Hope this helps somewhat get you started thinking about the questions to 
ask. Character encoding issues are definitely confusing. Which is why 
the more UTF-8 the better, just get everything into UTF-8 and don't look 
back.

Jonathan

Ken Irwin wrote:
> Hi all,
>
> I'm looking for a good source to help me understand character sets and how to use them. I pretty much know nothing about this - the whole world of Unicode, ASCII, octal, UTF-8, etc. is baffling to me.
>
> My immediate issue is that I think I need to integrate data from a variety of character sets into one MySQL table - I expect I need some way to convert from one to another, but I don't really even know how to tell which data are in which format.
>
> Our homegrown journal list (akin to SerialsSolutions) includes data ingested from publishers, vendors, the library catalog (III), etc. When I look at the data in emacs, some of it renders like this:
>  Revista de Oncolog\303\255a                  [slashes-and-digits instead of diacritics]
> And other data looks more like:
>  Revista de Música Latinoamericana    [weird characters instead of diacritics]
>
> My MySQL table is currently set up with the collation set to: utf8-bin , and the titles from the second category (weird characters display in emacs) render properly when the database data is output to the a web browser. The data from the former example (\###) renders as an "I don't know what character this is" placeholder in Firefox and IE.
>
> So, can someone please point me toward any or all of the following?
>
> ·         A good primer for understanding all of this stuff
>
> ·         A method for converting all of my data to the same character set so it plays nicely in the database
>
> ·         The names of which character-sets I might be working with here
>
> Many thanks!
>
> Ken
>
>