List:MySQL++« Previous MessageNext Message »
From:Charles J. Daniels Date:May 25 2013 8:48pm
Subject:query not yielding a utf8 result
View as plain text  
Hello,

I'm using a connection to mysql through 127.0.0.1 to a database I did not
create. The table files have a db.opt file among them whose only contents
say:

default-character-set=utf8
default-collation=utf8_general_ci


Now, I know the value I'm trying to retrieve is present and retrievable,
because it can be read an altered through the php page it was originally
designed to work with. The value I'm trying to retrieve is:
a-zA-ZÀ-ÖØ-öø-ȳ

But I don't get it correctly. The bytes I would expect, if utf8 would be:

0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0xc3 0x80, 0x2d, 0xc3, 0x96, 0xc3,
0x98, 0x2d, 0xc3, 0xb6, 0xc3, 0xb8, 0x2d, 0xc8, 0xb3

But what I get it:

0x61, 0x2d, 0x7a, 0x41, 0x2d, 0x5a, 0xffffffc0, 0x2d, 0xffffffd6,
0xffffffd8, 0x2d, 0xfffffff6, 0xfffffff8, 0x2d, 0x3f

Those ffffffXX values are like an f-padded latin-1 encoding for the
characters I'm looking for, except for the last byte, the 0x3f, which is
just a ? so would be the only work-aroundable data loss.

I do not know what encoding is actually held in the db, but as mentioned, I
know it's correctly retrievable. I do not understand why I'm not just
getting utf8 values in the first place, but it seems that the value in my
StoreResultSet is not utf8 itself. I do not know if it's the type of driver
I'm using or have available, or anything to do with the fact that I'm
connecting through 127.0.0.1. I do not know if the true utf8 values is
actually somehow embedded in a structure somewhere that I could retrieve.

Any ideas as to why I can't read the value properly?

Thanks,
--charlie

Thread
query not yielding a utf8 resultCharles J. Daniels25 May
  • Re: query not yielding a utf8 resultWarren Young28 May
    • Re: query not yielding a utf8 resultCharles J. Daniels28 May