# Character-encodings gem with Ruby 1.9

**URL:** <https://www.ruby-forum.com/t/character-encodings-gem-with-ruby-1-9/142723>\
**Category:** Ruby\
**Created:** [July 10, 2008, 9:22pm UTC](https://www.ruby-forum.com/t/character-encodings-gem-with-ruby-1-9/142723 "2008-07-10T21:22:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [July 10, 2008, 9:22pm UTC](https://www.ruby-forum.com/t/character-encodings-gem-with-ruby-1-9/142723/1 "2008-07-10T21:22:00Z")

</div>

Hello,

I tried to install Nikolai W.'s Ruby Character Encodings Library  
[1] with Ruby 1.9, but didn’t succeed.

$ sudo gem1.9 install character-encodings  
Building native extensions. This could take a while…  
ERROR: Error installing character-encodings:  
ERROR: Failed to build gem native extension.

/opt/local/bin/ruby1.9 extconf.rb install character-encodings  
extconf.rb:4: invalid multibyte char  
extconf.rb:4: invalid multibyte char  
extconf.rb:4: syntax error, unexpected $end, expecting keyword\_end  
checking\_for “â€˜#{opt}â€™ option to compiler” do  
^  
Gem files will remain installed in  
/opt/local/lib/ruby/gems/1.9.0/gems/character-encodings-0.4.1 for  
inspection.  
Results logged to  
/opt/local/lib/ruby/gems/1.9.0/gems/character-encodings-0.4.1/ext/encoding/character/utf-8/gem\_make.out

I downloaded the gem, extracted it, added a magic comment at the top of  
the file and manually called the configure command, that worked.

$ ruby1.9 extconf.rb install character-encodings  
checking for â€˜-std=c99â€™ option to compiler… yes  
checking for â€˜-finline-functionsâ€™ option to compiler… yes  
checking for â€˜-Wallâ€™ option to compiler… yes  
checking for â€˜-Wextraâ€™ option to compiler… yes  
checking for â€˜-Wwrite-stringsâ€™ option to compiler… yes  
checking for â€˜-Waggregate-returnâ€™ option to compiler… yes  
checking for â€˜-Wmissing-prototypesâ€™ option to compiler… yes  
checking for â€˜-Wmissing-declarationsâ€™ option to compiler… yes  
checking for â€˜-Wnested-externsâ€™ option to compiler… yes  
checking for â€˜-Wundefâ€™ option to compiler… yes  
checking for â€˜-Wpointer-arithâ€™ option to compiler… yes  
checking for â€˜-Wcast-alignâ€™ option to compiler… yes  
checking for â€˜-Werrorâ€™ option to compiler… yes  
checking for â€˜-Winlineâ€™ option to compiler… yes  
checking for assert.h… yes  
checking for limits.h… yes  
checking for locale.h… yes  
checking for stdbool.h… yes  
checking for stddef.h… yes  
checking for stdint.h… yes  
checking for stdio.h… yes  
checking for stdlib.h… yes  
checking for string.h… yes  
checking for sys/types.h… yes  
checking for wchar.h… yes  
creating Makefile

But then the make command failed.

$ make  
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0  
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE\_ASSERT\_H -DHAVE\_LIMITS\_H  
-DHAVE\_LOCALE\_H -DHAVE\_STDBOOL\_H -DHAVE\_STDDEF\_H -DHAVE\_STDINT\_H  
-DHAVE\_STDIO\_H -DHAVE\_STDLIB\_H -DHAVE\_STRING\_H -DHAVE\_SYS\_TYPES\_H  
-DHAVE\_WCHAR\_H -I/opt/local/include -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE  
-fno-common -O2 -fno-common -pipe -fno-common -std=c99  
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return  
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef  
-Wpointer-arith -Wcast-align -Werror -Winline -o break.o -c break.c  
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0  
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE\_ASSERT\_H -DHAVE\_LIMITS\_H  
-DHAVE\_LOCALE\_H -DHAVE\_STDBOOL\_H -DHAVE\_STDDEF\_H -DHAVE\_STDINT\_H  
-DHAVE\_STDIO\_H -DHAVE\_STDLIB\_H -DHAVE\_STRING\_H -DHAVE\_SYS\_TYPES\_H  
-DHAVE\_WCHAR\_H -I/opt/local/include -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE  
-fno-common -O2 -fno-common -pipe -fno-common -std=c99  
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return  
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef  
-Wpointer-arith -Wcast-align -Werror -Winline -o decompose.o -c  
decompose.c  
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0  
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE\_ASSERT\_H -DHAVE\_LIMITS\_H  
-DHAVE\_LOCALE\_H -DHAVE\_STDBOOL\_H -DHAVE\_STDDEF\_H -DHAVE\_STDINT\_H  
-DHAVE\_STDIO\_H -DHAVE\_STDLIB\_H -DHAVE\_STRING\_H -DHAVE\_SYS\_TYPES\_H  
-DHAVE\_WCHAR\_H -I/opt/local/include -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE  
-fno-common -O2 -fno-common -pipe -fno-common -std=c99  
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return  
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef  
-Wpointer-arith -Wcast-align -Werror -Winline -o private.o -c private.c  
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0  
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE\_ASSERT\_H -DHAVE\_LIMITS\_H  
-DHAVE\_LOCALE\_H -DHAVE\_STDBOOL\_H -DHAVE\_STDDEF\_H -DHAVE\_STDINT\_H  
-DHAVE\_STDIO\_H -DHAVE\_STDLIB\_H -DHAVE\_STRING\_H -DHAVE\_SYS\_TYPES\_H  
-DHAVE\_WCHAR\_H -I/opt/local/include -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE  
-fno-common -O2 -fno-common -pipe -fno-common -std=c99  
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return  
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef  
-Wpointer-arith -Wcast-align -Werror -Winline -o properties.o -c  
properties.c  
/usr/bin/gcc-4.0 -I. -I/opt/local/include/ruby-1.9.0/i686-darwin9.3.0  
-I/opt/local/include/ruby-1.9.0 -I. -DHAVE\_ASSERT\_H -DHAVE\_LIMITS\_H  
-DHAVE\_LOCALE\_H -DHAVE\_STDBOOL\_H -DHAVE\_STDDEF\_H -DHAVE\_STDINT\_H  
-DHAVE\_STDIO\_H -DHAVE\_STDLIB\_H -DHAVE\_STRING\_H -DHAVE\_SYS\_TYPES\_H  
-DHAVE\_WCHAR\_H -I/opt/local/include -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE  
-fno-common -O2 -fno-common -pipe -fno-common -std=c99  
-finline-functions -Wall -Wextra -Wwrite-strings -Waggregate-return  
-Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Wundef  
-Wpointer-arith -Wcast-align -Werror -Winline -o rb\_utf\_aref.o -c  
rb\_utf\_aref.c  
rb\_utf\_aref.c:8:16: error: re.h: No such file or directory  
cc1: warnings being treated as errors  
rb\_utf\_aref.c: In function â€˜rb\_str\_subpatâ€™:  
rb\_utf\_aref.c:44: warning: implicit declaration of function  
â€˜rb\_reg\_searchâ€™  
rb\_utf\_aref.c:44: warning: nested extern declaration of â€˜rb\_reg\_searchâ€™  
rb\_utf\_aref.c: In function â€˜rb\_utf\_aref\_defaultâ€™:  
rb\_utf\_aref.c:65: error: â€˜struct RStringâ€™ has no member named â€˜ptrâ€™  
rb\_utf\_aref.c:65: error: â€˜struct RStringâ€™ has no member named â€˜lenâ€™  
make: \*\*\* [rb\_utf\_aref.o] Error 1

What can I do to make it work?

Stefan

[1] [http://bitwi.se/software/ruby/character-encodings/](http://bitwi.se/software/ruby/character-encodings/)

---

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [July 10, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/character-encodings-gem-with-ruby-1-9/142723/2 "2008-07-10T22:01:16Z")

</div>

On Jul 10, 2008, at 2:17 PM, Stefan S. wrote:

> I tried to install Nikolai W.'s Ruby Character Encodings  
> Library [1] with Ruby 1.9, but didn’t succeed.

Do you know that 1.9 has excellent built-in support for character  
encodings?

Dave

---

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [July 11, 2008, 12:04am UTC](https://www.ruby-forum.com/t/character-encodings-gem-with-ruby-1-9/142723/3 "2008-07-11T00:04:53Z")

</div>

> > I tried to install Nikolai W.'s Ruby Character Encodings  
> > Library [1] with Ruby 1.9, but didn’t succeed.
> 
> Do you know that 1.9 has excellent built-in support for character  
> encodings?

Yes, but String#upcase/downcase doesn’t work for non-ascii strings.

Stefan

---

<div class="post-metadata">

**Author:** ![stefans](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@stefans](https://www.ruby-forum.com/u/stefans)\
**Post date:** [July 15, 2008, 12:41pm UTC](https://www.ruby-forum.com/t/character-encodings-gem-with-ruby-1-9/142723/4 "2008-07-15T12:41:00Z")

</div>

In article [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
Dave T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Do you know that 1.9 has excellent built-in support for character  
> encodings?

Like the OP said, as long as #upcase/#downcase don’t work, I’d not call  
that  
excellent.

I can certainly understand the constraints of locales/i18n/m17n and the  
way  
choosen by Matz for Ruby, but I’m getting frustrated by the support (or  
more  
exactly lack thereof) of Unicode strings.

I’m looking at friends that have chosen Python and while their way may  
not be  
the Right One (if there is such a way) but they are enjoying it for  
common  
usage.

For a language that toots POLA as a slogan, Unicode support is certainly  
violating every principle there. I’m following 1.9 closely through svn  
and  
regularely try to use the Unicode support but it is not getting better.

Sorry if it sounds grumpy but I’m getting frustrated by my favorite  
language  
and am afraid it shows.
