🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.ruby
Article #705

Re: unicode

#705
From: TomekC
Date: Wed, 07 Nov 2007 12:30
30 lines
1427 bytes
moldovenu pisze:
> jak wygląda obecnie obsługa unikodu w Rubym?
> jest jakaś opcja, pragma, biblioteka czy to dopiero w rb2?
> 
> str = "gżegżółka"
> => "g\305\274eg\305\274\303\263\305\202ka"
> 
> str[1].to_i.chr
> => "\305"
> 
> fuj!

Niestety, z tego co wiem, to na razie trzeba się posługiwać atrapą, 
czyli metodą "chars"

str = "gżegżółka"

str.chars.length
=> 9

do str.chars aplikują się wszystkie metody klasy string:

str.chars.upcase
=> "GŻEGŻÓŁKA"

itd...


-- 
Tomek małpka japko kropka info.
Technical Details
Message-ID: <fgsbf9$9l3$1@nemesis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.internetia.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <fgs8ge$aji$1@news.onet.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!news.internetia.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: TomekC <tomek@adres.podaje.w.stopce.pl>
Newsgroups: pl.comp.lang.ruby
Subject: Re: unicode
Date: Wed, 07 Nov 2007 13:30:15 +0100
Organization: tp.internet - http://www.tpi.pl/
Lines: 30
Message-ID: <fgsbf9$9l3$1@nemesis.news.tpi.pl>
References: <fgs8ge$aji$1@news.onet.pl>
NNTP-Posting-Host: fw.softnet.pl
Mime-Version: 1.0
X-Trace: nemesis.news.tpi.pl 1194438953 9891 195.116.43.34 (7 Nov 2007 12:35:53 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Wed, 7 Nov 2007 12:35:53 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
In-Reply-To: <fgs8ge$aji$1@news.onet.pl>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit