Forum: Ruby Ruby and unicode

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-05-24 20:05
Does Ruby support unicode? If not it's a disappointment.
921432719b51a266a06878ff4128a7b1?d=identicon&s=25 Dae San Hwang (Guest)
on 2006-05-24 20:19
(Received via mailing list)
Well, there are extension libraries for handling unicodes.  It is
also expected that Ruby 2.0 will bring more complete I18N supports.

What are your needs?

daesan


On May 25, 2006, at 3:05 AM, Pål Bergström wrote:

> Does Ruby support unicode? If not it's a disappointment.
>
> --
> Posted via http://www.ruby-forum.com/.
>

Dae San Hwang
daesan@gmail.com
3275da7fdbd73cb4e7956fd0d29164de?d=identicon&s=25 Paul Bergstrom (palb)
on 2006-05-24 21:19
Dae San Hwang wrote:
> Well, there are extension libraries for handling unicodes.  It is
> also expected that Ruby 2.0 will bring more complete I18N supports.
>
> What are your needs?
>
> daesan
>
>
> On May 25, 2006, at 3:05 AM, Pål Bergström wrote:
>
>> Does Ruby support unicode? If not it's a disappointment.
>>
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>
> Dae San Hwang
> daesan@gmail.com

Just to be able to work smoothly from source to browser in Swedish
without problems, the beauty of unicode. As I can understand it works
like php, where certain methods like string lengths can give problems,
but besides that it just passes it through. Is this correct?
F2749ed0e8e8c1a84e5ab57b45c61503?d=identicon&s=25 Peter Krantz (Guest)
on 2006-05-24 22:39
(Received via mailing list)
On 5/24/06, Pål Bergström <pal@palbergstrom.com> wrote:

> Just to be able to work smoothly from source to browser in Swedish
> without problems, the beauty of unicode.

Pål, you don't have to use unicode to work in swedish. ISO-8859-1 will
be sufficient to get accented characters including åäö. ISO-8859-1 is
handled by Ruby without any problems.

If your are working in Rails, please see the swedish Rails user group
wiki for details:

http://rails.se/rails/show/Railstips+för+svenska+a...

Regards,

Peter
921432719b51a266a06878ff4128a7b1?d=identicon&s=25 Dae San Hwang (Guest)
on 2006-05-24 23:04
(Received via mailing list)
Yes, strings in UTF8 (or any character set for that matter) simply
pass through since they are just byte sequence.

If you need methods that properly manipulate UTF8 strings, install
unicode gem and install unicode hacks from http://
julik.textdriven.com/svn/tools/rails_plugins/unicode_hacks/

Unicode hacks replaces String methods with UTF8 aware versions.

You would also need to put following code snippet in config/
environment.rb:

$KCODE = 'u'

http://wiki.rubyonrails.com/rails/pages/HowToUseUn... is a
good resource for unicode usage on rails.

daesan


On May 25, 2006, at 4:20 AM, Pål Bergström wrote:

> Just to be able to work smoothly from source to browser in Swedish
> without problems, the beauty of unicode. As I can understand it works
> like php, where certain methods like string lengths can give problems,
> but besides that it just passes it through. Is this correct?

Dae San Hwang
daesan@gmail.com
2a321daf565791ad30ac5ee945abf59a?d=identicon&s=25 Izidor Jerebic (Guest)
on 2006-05-26 18:40
(Received via mailing list)
On 24.5.2006, at 23:02, Dae San Hwang wrote:
>
> If you need methods that properly manipulate UTF8 strings, install
> unicode gem and install unicode hacks from http://
> julik.textdriven.com/svn/tools/rails_plugins/unicode_hacks/
>
> Unicode hacks replaces String methods with UTF8 aware versions.
>

You should not advise the use of unicode hacks plugin, since it will
very probably break any Rails application.

See for example <http://www.fngtps.com/2006/01/encoding-in-rails> and
<http://redhanded.hobix.com/inspect/unicodeLibForRu......


Regards,

izidor
921432719b51a266a06878ff4128a7b1?d=identicon&s=25 Dae San Hwang (Guest)
on 2006-05-26 21:08
(Received via mailing list)
Right, that is because Rails depend on many of String methods that
unicode_hacks replaces.

However, you can just rename the method names in unicode_hacks.  I
just add 'u_' prefix to all the methods in unicode_hacks.

Cheers,
Daesan


On May 27, 2006, at 1:38 AM, Izidor Jerebic wrote:

> You should not advise the use of unicode hacks plugin, since it
>
Dae San Hwang
daesan@gmail.com
This topic is locked and can not be replied to.