ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: "Anton V. Boyarshinov" <boyarsh@altlinux.org>
To: sisyphus@lists.altlinux.org
Subject: Re: [sisyphus] странное и некрасивое поведение utf8 в паре rails/mysql
Date: Thu, 25 Jun 2009 10:57:16 +0400
Message-ID: <20090625105716.08dac53b@ws334-don.hq.armd.ru> (raw)
In-Reply-To: <69c7dc8b0906240931w74de4efqf66ed0f0bad93902@mail.gmail.com>

On Wed, 24 Jun 2009 20:31:40 +0400 Michael Bykov wrote:

> странное и некрасивое поведение utf8 в паре rails/mysql
> Вторая строка - корректный результат, первая загадочна:
> 
> первая буква слова в поле wo_stress, по которому я ищу, ἰ = 0xF130, а
> в значении, которое mysql нашёл, ἱ = 0x1F31. То есть это разные
> строки!

Конкретно про MySQL не скажу, но про unicode вообще.. Ситуация на
первый взгляд, конечно, странная, но по своему корректная.. Дело в том,
что unicode это не кодировка в обычном смысле, а довольно сложная штука
(даже без учёта конечного автомата utf8). Многие символы можно записать
в unicode разными способами, и в ряде случаев они при этом должны
трактоваться как одинаковые.

Так, например, русская буква 'й' может быть записана двумя
равнозначными способами: как один глиф 'й' и как (два глифа) 'и' с
надстрочным символом (MacOS X использует второй способ, что порождает
порядочную кашу при переносе по крайней мере файлов, содержащих 'й' в
имени). Аналогично ё. Насчёт вашего примера в корректности работы
поиска не уверен, но вероятность того что в данному случае правильное
unicode сравнение должно работать именно так, оцениваю как высокое. При
unicode сравнении сравниваются не байты.

Антон


  reply	other threads:[~2009-06-25  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-24 16:31 Michael Bykov
2009-06-25  6:57 ` Anton V. Boyarshinov [this message]
2009-06-26 10:30   ` Michael Bykov
2009-06-28  6:16     ` Mikhail Yakshin
2009-06-28  6:55       ` Michael Bykov
2009-06-28  8:41       ` Afanasov Dmitry

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090625105716.08dac53b@ws334-don.hq.armd.ru \
    --to=boyarsh@altlinux.org \
    --cc=sisyphus@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git