|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi friends,
Could any one me in writing a method which reads all Unicode characters supported in ruby or else using regular expressions. Thanks in advance, Regards, Jose Martin -- Posted via http://www.ruby-forum.com/. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
dare ruby wrote:
> Hi friends, > > Could any one me in writing a method which reads all Unicode > characters supported in ruby or else using regular expressions. > > Thanks in advance, > > > Regards, > Jose Martin Ruby does not support unicode. -- Posted via http://www.ruby-forum.com/. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Mar 10, 2008, at 10:00 AM, 7stud -- wrote:
> dare ruby wrote: >> Hi friends, >> >> Could any one me in writing a method which reads all Unicode >> characters supported in ruby or else using regular expressions. >> >> Thanks in advance, >> >> >> Regards, >> Jose Martin > > Ruby does not support unicode. Really? $ ruby -KU -r jcode -e 'p "R=E9sum=E9".jsize' 6 James Edward Gray II= |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Is there any possibilities using regular expressions or writing own
methods for unicode charatcers? >> >> Ruby does not support unicode. > > Really? > > $ ruby -KU -r jcode -e 'p "R�sum�".jsize' > 6 > > James Edward Gray II -- Posted via http://www.ruby-forum.com/. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
James Gray wrote:
> On Mar 10, 2008, at 10:00 AM, 7stud -- wrote: > >>> Jose Martin >> >> Ruby does not support unicode. > > Really? > > $ ruby -KU -r jcode -e 'p "Résumé".jsize' > 6 > > James Edward Gray II How does that prove the ruby supports unicode? Where are there any unicode characters in your string? -- Posted via http://www.ruby-forum.com/. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
7stud -- wrote:
> James Gray wrote: >> [...] >> $ ruby -KU -r jcode -e 'p "R�sum�".jsize' >> 6 >> >> James Edward Gray II > > How does that prove the ruby supports unicode? Where are there any > unicode characters in your string? 1/ There's a difference between codepoints and characters, speaking of unicode "characters" is confusing at best. 2/ "Supporting unicode" is probably meaningless (which unicode encoding by the way?), building UTF-8 applications in Ruby is perfectly doable thanks to jcode, regex UTF-8 support, ... I know, among other things it's what I built my company on. The example above obviously assumes an UTF-8 locale in the terminal you type it... For more data, just try size instead of jsize in the same example and read jcode's rdoc. Lionel |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
On Mar 10, 2008, at 10:29 PM, 7stud -- wrote:
> James Gray wrote: >> On Mar 10, 2008, at 10:00 AM, 7stud -- wrote: >> >>>> Jose Martin >>> >>> Ruby does not support unicode. >> >> Really? >> >> $ ruby -KU -r jcode -e 'p "R=E9sum=E9".jsize' >> 6 >> >> James Edward Gray II > > How does that prove the ruby supports unicode? If the code was not character aware, it would have returned a count of =20= the bytes in the String (more than six). String#size, for example. > Where are there any unicode characters in your string? I entered the accented e characters in UTF-8, that's why you see the -=20= KU switch to tell Ruby the encoding. James Edward Gray II |
|
|
|
#8 |
|
Messages: n/a
Hébergeur: |
On Tue, Mar 11, 2008 at 7:49 AM, James Gray <james@grayproductions.net> wro=
te: > > If the code was not character aware, it would have returned a count of > the bytes in the String (more than six). String#size, for example. > > > > Where are there any unicode characters in your string? > > I entered the accented e characters in UTF-8, that's why you see the - > KU switch to tell Ruby the encoding. > > James Edward Gray II I think this may have been discussed before, but -KU doesn't work for me on Windows XP. I get an unterminated string error with the "R=E9sum=E9" UTF-8 encoded string. I can only assume that the parser is still interpreting the string as one byte per character. Anyone have any ideas? Todd |
|
![]() |
| Outils de la discussion | |
|
|