Re: mysql lenght() and char_length not working for longer texts

From: Thomas 'PointedEars' Lahn <PointedEars_at_web.de>
Date: Tue, 07 Jul 2015 11:09:04 +0200
Message-ID: <3594764.8s91zndXLF_at_PointedEars.de>


Axel Schwenke wrote:

> Thomas 'PointedEars' Lahn <PointedEars_at_web.de> wrote:

>> Lennart Jonsson wrote:
>>> If you store unicode characters in a column you better use a character
>>> set that supports it, like utf-8
>>>
>>> create table t (x varchar(3) not null)
>>> engine = innodb character set utf8;
>>
>> _UTF-8_ is _not_ a character set.  It is a character _encoding_ for a
>> character set.

>
> Smartass!

_Not_ pleased to meet you.

> MySQL itself uses the term "CHARACTER SET" in the parser and in the
> manual.

Yes, I know (which you would have known if you cared to read what you replied to). Therefore the correction.

> Your point is completely useless in the context "MySQL".

No, it is not.

> If you are not willing to help with THE PROBLEM but would rather BE
> RIGHT then I ask you to be silent.

Usenet is not a support forum.

> You are not helpful.

Your humble opinion. I suggest you go into a shower, river, or lake, cool down, and reconsider.

>>> Assuming this is true, there are characters that are represented with
>>> more than two bytes so just doubling the space wont suffice,
>>
>> It will not.  In UTF-8, a Unicode character can be encoded with up to 6
>> 8-bit bytes.

>
> Again: the context is MySQL. Here a column with CHARACTER SET utf8 can
> use at most 3 bytes per character because MySQL supports only
> characters from the BMP (Unicode U+0 ... U+FFFF) […]

This is confirmed by the manual. It also confirms that MySQL can support characters beyond the BMP now with using different "character sets". (A pity that you did not care to substantiate your statements with a reference.)

<https://dev.mysql.com/doc/refman/5.7/en/charset-unicode.html>

> and those can all be encoded in utf8 sequences with at most 3 bytes.

_UTF-8_, yes.

<https://en.wikipedia.org/wiki/UTF-8>

-- 
PointedEars

Twitter: _at_PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
Received on Tue Jul 07 2015 - 11:09:04 CEST

Original text of this message