From: "Alexey I. Froloff" <raorn@altlinux.org>
To: ALT Linux Sisyphus discussion list <sisyphus@lists.altlinux.org>
Subject: Re: [sisyphus] Redmine и кириллица в названиях файлов
Date: Fri, 23 Jul 2010 19:57:01 +0400
Message-ID: <20100723155701.GB17241@altlinux.org> (raw)
In-Reply-To: <4C49AE82.1080304@rambler.ru>
[-- Attachment #1: Type: text/plain, Size: 872 bytes --]
On Fri, Jul 23, 2010 at 06:00:18PM +0300, Денис Ягофаров wrote:
> Исследовав проблему, я определил, что во всём виновато
> app/models/attachment.rb ,
> а именно в функции sanitize_filename строка:
> @filename = just_filename.gsub(/[^\w\.\-]/,'_')
> Если её земенить на:
> @filename = just_filename.force_encoding('UTF-8')
Ruby 1.9 прекрасно работает с юникодом. Проблема в головах у
некоторых идиотов-рубероидов с семибитными мозгами:
$ LC_CTYPE=ru_RU.UTF-8 ruby -e 'puts "a,п╟,b,п╠,c,п╡".gsub(/[^\w]/, "")'
abc
$ LC_CTYPE=ru_RU.UTF-8 ruby -e 'puts "a,п╟,b,п╠,c,п╡".gsub(/[^[:word:]]/, "")'
aп╟bп╠cп╡
Т.е. меняем \w (который на самом деле [A-Za-z0-9_]) на [:word:]
(который word chars с учётом локали).
P.S. Извините за пяпя, я from the past и живу в koi8-r ;-)
--
Regards, --
Sir Raorn. --- http://thousandsofhate.blogspot.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
prev parent reply other threads:[~2010-07-23 15:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-23 15:00 Денис Ягофаров
2010-07-23 15:05 ` Денис Ягофаров
2010-07-23 15:57 ` Alexey I. Froloff [this message]
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=20100723155701.GB17241@altlinux.org \
--to=raorn@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