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.
Paul B. (Guest)
on 2006-05-24 22:05
Does Ruby support unicode? If not it's a disappointment.
Dae San H. (Guest)
on 2006-05-24 22: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 H.
removed_email_address@domain.invalid
Paul B. (Guest)
on 2006-05-24 23:19
Dae San H. 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 H.
> removed_email_address@domain.invalid

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?
Peter K. (Guest)
on 2006-05-25 00:39
(Received via mailing list)
On 5/24/06, Pål Bergström <removed_email_address@domain.invalid> 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
Dae San H. (Guest)
on 2006-05-25 01: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 H.
removed_email_address@domain.invalid
Izidor J. (Guest)
on 2006-05-26 20:40
(Received via mailing list)
On 24.5.2006, at 23:02, Dae San H. 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
Dae San H. (Guest)
on 2006-05-26 23: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 J. wrote:

> You should not advise the use of unicode hacks plugin, since it
>
Dae San H.
removed_email_address@domain.invalid
This topic is locked and can not be replied to.