How to capitalize nonascii characters?

Why #capitaize not working here as documented -

Returns a copy of str with the first character converted to uppercase
and the remainder to lowercase. **Note: case conversion is effective
only in ASCII region.**

(arup~>~)$ pry --simple-prompt

s = "école"

=> "école"

s.capitalize

=> "école"

How to do this here?

···

--
Posted via http://www.ruby-forum.com/.

Dear Arup,

I don't know if this is the current answer.
I was just curious and googled a little and found this.

gem install unicode

#!/usr/bin/env ruby
#coding: utf-8

require 'unicode'

puts Unicode::capitalize("école")

Source: http://stackoverflow.com/questions/3724913/capitalize-first-letter-in-ruby

Abinoam Jr.

···

On Mon, Feb 3, 2014 at 7:49 PM, Arup Rakshit <lists@ruby-forum.com> wrote:

Why #capitaize not working here as documented -

Returns a copy of str with the first character converted to uppercase
and the remainder to lowercase. **Note: case conversion is effective
only in ASCII region.**

(arup~>~)$ pry --simple-prompt

s = "école"

=> "école"

s.capitalize

=> "école"

How to do this here?

--
Posted via http://www.ruby-forum.com/.

Hi,

Yes, use unicode gem for now. String operations on non ASCII
characters are one of the topics for upcoming Ruby 2.2.

              matz.

···

In message "Re: how to capitalize nonascii characters ?" on Tue, 4 Feb 2014 01:19:51 -0200, "Abinoam Jr." <abinoam@gmail.com> writes:

Dear Arup,

I don't know if this is the current answer.
I was just curious and googled a little and found this.

gem install unicode

Unicode does it. I'm having a problem getting it deployed at the
moment because the deployment server is in rather a strange state, but
the gem itself works a treat. My problem space was different, as I
needed to ensure email addresses were unique in spite of having
different cases, but unicode solved the problem.

···

On Mon, Feb 3, 2014 at 9:19 PM, Abinoam Jr. <abinoam@gmail.com> wrote:

Dear Arup,

I don't know if this is the current answer.
I was just curious and googled a little and found this.

gem install unicode

#!/usr/bin/env ruby
#coding: utf-8

require 'unicode'

puts Unicode::capitalize("école")

Source: http://stackoverflow.com/questions/3724913/capitalize-first-letter-in-ruby

Abinoam Jr.

On Mon, Feb 3, 2014 at 7:49 PM, Arup Rakshit <lists@ruby-forum.com> wrote:

Why #capitaize not working here as documented -

Returns a copy of str with the first character converted to uppercase
and the remainder to lowercase. **Note: case conversion is effective
only in ASCII region.**

(arup~>~)$ pry --simple-prompt

s = "école"

=> "école"

s.capitalize

=> "école"

How to do this here?

--
Posted via http://www.ruby-forum.com/.