# Language encoding

**URL:** <https://www.ruby-forum.com/t/language-encoding/81610>\
**Category:** Ruby\
**Created:** [January 10, 2007, 5:04pm UTC](https://www.ruby-forum.com/t/language-encoding/81610 "2007-01-10T17:04:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSSSSrg\_Hagmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@JSSSSrg\_Hagmann](https://www.ruby-forum.com/u/JSSSSrg_Hagmann)\
**Post date:** [January 10, 2007, 5:04pm UTC](https://www.ruby-forum.com/t/language-encoding/81610/1 "2007-01-10T17:04:23Z")

</div>

I have written a simple answer-question programme (to be used in the  
terminal) for students and I need French and German characters (Ã , Ã¼  
etc.):  
I’ve written it in Emacs, on a mac, English keyboard and operating  
system. It worked.  
When I tried it on a Linux computer (English environment) it didn’t.  
I then thought I figured it out: I chose utf-8 wherever possible in  
Emacs (e.g. “set coding system for saving this buffer”, without  
understanding what exactly I was doing, I’m afraid) and by including  
$KCODE = ‘UTF-8’  
require ‘jcode’  
in my file (something I got from the “Ruby cookbook”). That worked –  
on the Linux box. But the file no longer showed the correct  
characters on the Mac. And it also didn’t on a Windows machine.

As I was planning to distribute the programme to the students on  
Monday, and as I’m sure it won’t work on their mainly Windows boxes  
running whatever language, I decided to ask for help here. You must  
have understood from my question that any answer should be kept as  
simple as possible…  
Thanks in advance, JÃ¶rg.

Prof.Dr.med. JÃ¶rg Hagmann-Zanolari  
Institute of Biochemistry and Genetics  
DKBW, University of Basel  
Mattenstrasse 28  
CH-4058 Basel  
Switzerland  
Phone +41 (0)61 267 3565

---

<div class="post-metadata">

**Author:** ![JSSSSrg\_Hagmann](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc8723/32.png) [@JSSSSrg\_Hagmann](https://www.ruby-forum.com/u/JSSSSrg_Hagmann)\
**Post date:** [January 10, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/language-encoding/81610/2 "2007-01-10T17:20:33Z")

</div>

On Jan 10, 2007, at 08:04, Jörg Hagmann wrote:

> require ‘jcode’  
> in my file (something I got from the “Ruby cookbook”). That worked  
> – on the Linux box. But the file no longer showed the correct  
> characters on the Mac. And it also didn’t on a Windows machine.

If this is a terminal program then on the mac ensure that the  
terminal character set encoding is set to UTF-8. You can find this  
setting in the Display settings of the Window Settings dialog under  
the Terminal menu.

> Mattenstrasse 28  
> CH-4058 Basel  
> Switzerland  
> Phone +41 (0)61 267 3565

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)

I LIT YOUR GEM ON FIRE!
