PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > Reding unicode characters?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Reding unicode characters?

Réponse
 
LinkBack Outils de la discussion
Vieux 10/03/2008, 04h37   #1
dare ruby
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Reding unicode characters?

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/.

  Réponse avec citation
Vieux 10/03/2008, 16h00   #2
7stud --
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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/.

  Réponse avec citation
Vieux 10/03/2008, 16h13   #3
James Gray
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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=

  Réponse avec citation
Vieux 11/03/2008, 04h15   #4
dare ruby
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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/.

  Réponse avec citation
Vieux 11/03/2008, 04h29   #5
7stud --
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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/.

  Réponse avec citation
Vieux 11/03/2008, 11h02   #6
Lionel Bouton
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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
  Réponse avec citation
Vieux 11/03/2008, 13h49   #7
James Gray
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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


  Réponse avec citation
Vieux 11/03/2008, 17h35   #8
Todd Benson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Reding unicode characters?

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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 07h27.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11252 seconds with 16 queries