# Parse errors in accentuated strings after Globalizing

**URL:** <https://www.ruby-forum.com/t/parse-errors-in-accentuated-strings-after-globalizing/73294>\
**Category:** Rails I18n\
**Created:** [October 23, 2006, 5:04pm UTC](https://www.ruby-forum.com/t/parse-errors-in-accentuated-strings-after-globalizing/73294 "2006-10-23T17:04:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![josealvarez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@josealvarez](https://www.ruby-forum.com/u/josealvarez)\
**Post date:** [October 23, 2006, 5:04pm UTC](https://www.ruby-forum.com/t/parse-errors-in-accentuated-strings-after-globalizing/73294/1 "2006-10-23T17:04:52Z")

</div>

After installing Globalize and adding the following lines to the files:

* * *

environment.rb at the end:

include Globalize  
Locale.set\_base\_language ‘es-ES’  
Locale.set(‘es-ES’)  
LOCALES = {‘es’ =\> ‘es-ES’,  
‘en’ =\> ‘en-EN’}.freeze

routes.rb at the begining:

map.connect ‘:locale/:controller/:action/:id’

application.rb:

## before\_filter :set\_locale def set\_locale begin Locale.set params[:locale] rescue ArgumentError redirect\_to params.merge( ‘locale’ =\> Locale.base\_language.code ) end end

some accentuated strings now give me a lot of problems that they were  
not giving before the Globalize installation.I have a controller in  
which:

```
@options << option("InvestigaciÃ³n","investigacion","index")

```

throws the following error:  
./script/…/config/…/app/controllers/menu\_controller.rb:14: parse  
error, unexpected tIDENTIFIER, expecting ‘)’  
@options \<\< option(“Investigaciï¿½n”,“investigacion”,“index”)  
^  
This can be solved changing “InvestigaciÃ³n” with “Investigacion”. But  
I’ve read that the base language can be the one of your choice. Because  
all the basic content of the web is spanish I decided to set the base  
language to spanish.

I’m worried because I thought that the web that I’m trying to  
internationalize (to english) should work perfectly in spanish as it was  
before.

If someone had this problem and knows where the problem is, I would  
appreciate a little help with the question.

Best regards

---

<div class="post-metadata">

**Author:** ![josealvarez](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/b38774/32.png) [@josealvarez](https://www.ruby-forum.com/u/josealvarez)\
**Post date:** [October 23, 2006, 6:19pm UTC](https://www.ruby-forum.com/t/parse-errors-in-accentuated-strings-after-globalizing/73294/2 "2006-10-23T18:19:40Z")

</div>

not sure, but it could be related to the fact that ruby doesn’t natively  
support charsets in the strings.

Usually you can fix this kind of problems by using jcode and setting  
KCODE to UTF-8 at environment.rb by adding these two lines of code

|$KCODE = ‘u’  
require ‘jcode’

|  
After you do this, the lenght of strings and so on works on multichar  
strings. A quick search in google by jcode and rails should put you on  
the right track for these.

Not sure if that’s your problem, but for sure it’s a good practice when  
dealing with non-english charsets

saludos 😉

javier
