# Transliteration problems

**URL:** <https://www.ruby-forum.com/t/transliteration-problems/152885>\
**Category:** Ruby\
**Created:** [November 8, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/transliteration-problems/152885 "2008-11-08T23:13:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axel\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7c8e57/32.png) [@Axel\_E](https://www.ruby-forum.com/u/Axel_E)\
**Post date:** [November 8, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/transliteration-problems/152885/1 "2008-11-08T23:13:05Z")

</div>

Dear all,

I’d like to transliterate some accented text, just removing the accents.  
The encoding should be iso-8859-1 (source and destination).

I am on Ubuntu 8.04, and I get the following:

require “rubygems”  
require “iconv”

s="caffè"p Iconv.iconv(“ascii//translit”,“iso-8859-1”,s)[0] =\> “caff?”

Is there any way to get “caffe” ?

I read in some earlier post to a Ruby list that there are different  
language locales to Iconv,  
but I couldn’t find how to specify any in Ruby Iconv :

[http://groups.google.de/group/comp.lang.ruby/browse\_thread/thread/40d823813170aa9a](http://groups.google.de/group/comp.lang.ruby/browse_thread/thread/40d823813170aa9a)

Thank you very much for your help!

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![Axel\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7c8e57/32.png) [@Axel\_E](https://www.ruby-forum.com/u/Axel_E)\
**Post date:** [November 9, 2008, 12:09am UTC](https://www.ruby-forum.com/t/transliteration-problems/152885/2 "2008-11-09T00:09:18Z")

</div>

On Sat, 08 Nov 2008 23:10:12 +0100, Axel E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> p Iconv.iconv(“ascii//translit”,“iso-8859-1”,s)[0] =\> “caff?”

It seems as if either your system is broken or the file is not in ISO  
8859-1 because that conversion _should_ work and it does so on my Fedora  
9:

Linux [pen2.homeunix.net](http://pen2.homeunix.net) 2.6.26.6-79.fc9.x86\_64 #1 SMP Fri Oct 17  
14:20:33  
EDT 2008 x86\_64 x86\_64 x86\_64 GNU/Linux

$ iconv --version|head -1  
iconv (GNU libc) 2.8

Are you sure that you do not get “caffA?” in place of “caff?”? That  
would  
suggest that the file is encoded using utf8, not an encoding of the ISO  
8859 familiy.

Josef ‘Jupp’ Schugt

---

<div class="post-metadata">

**Author:** ![Axel\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/7c8e57/32.png) [@Axel\_E](https://www.ruby-forum.com/u/Axel_E)\
**Post date:** [November 9, 2008, 11:11am UTC](https://www.ruby-forum.com/t/transliteration-problems/152885/3 "2008-11-09T11:11:56Z")

</div>

See if  
[http://groups.google.com/group/ruby-talk-google/browse\_thread/thread/96c75d3587012556](http://groups.google.com/group/ruby-talk-google/browse_thread/thread/96c75d3587012556)  
helps.
