Failed to load translations: invalid final UTF-8 octet in YAML

I am new to rails and trying to internationalize my application using I18n. In the local yaml file for the Spanish version, im is trying to configure translations as follows:

es:
  categories: "Categorias"
  home: Inicio
  live_casino: "Casino en Vivo"
  sportsbook: Deportes

It works like a charm, but as soon as I add emphasis in the Spanish word as follows:

categories: "Categorías"

Rails tells me the following error:

I18n::InvalidLocaleData in WelcomeController#index
can not load translations from .../config/locales/es.yml: #<Psych::SyntaxError: (.../config/locales/es.yml): invalid trailing UTF-8 octet at line 1 column 1>

Ive tried everything I found on the Internet and nothing worked, please help!

+4
source share
2 answers

I opened the locale file in Notepad ++ and noticed that it was encoded in "UTF-8 without specification". Changed it to "UTF8" and the error disappeared.

+6

es.yml:

# encoding: utf-8    
0

Source: https://habr.com/ru/post/1533178/


All Articles