MySQL Forums
Forum List  »  General

Re: load data infile: "Incorrect string value" with special chars
Posted by: Rick James
Date: November 21, 2011 11:40PM

> This is the € symbol. For as far as I know, this is UTF8, or am I wrong about this?

Quickie lesson in terminology (more discussion in the link I gave you)...
A "character" or a "symbol" (such as the Euro sign) is distinct from the "representation" or "encoding" of that character or symbol.

There are many different encodings, even for the same characters and symbols. "latin1" and "utf8" are commonly used encodings in MySQL. Some encodings:

The "entity" in HTML for the Euro sign is 7 or 6 bytes long: € or €. But I digress.
ISO-8859-15 uses the single byte 0xA4.
latin1: â = 0xE2, € = 0x80 (one byte each).
UNICODE: U+20AC EURO SIGN (2 bytes)
utf8: E282A0 (₠) for EURO-CURRENCY SIGN (3 bytes) (ok, another digression)
utf8: E282AC (€) for EURO SIGN (3 bytes)

> DEFAULT CHARSET=utf8;
Feeding hex E2 to it (regardless of what E2 is supposed to be) will cause MySQL to abort on the insert. This is because E2, if it is not followed by certain byte configurations, is not a valid utf8 character.

> '\xE2n - G...'
This says that the E2 was followed by 'n', hence invalid for utf8 encoding.

Options: ReplyQuote


Subject
Written By
Posted
Re: load data infile: "Incorrect string value" with special chars
November 21, 2011 11:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.