I am working on an application in which we do translations for English/Spanish/French using a JSON file. I am a bit confused on if I need to use ISO 8859-1 Characters (their entity number) for the extra symbols on Spanish and French words. Everything is rendering properly (ex: é í ñ ¿) but am I not sure if I am doing it incorrectly.

Ex. W/ ISO 8859-1 Characters (these are using entity names, I heard using entity numbers are better?):

  "resultsperpage":"Resultados / Página",

  "customer":"Cliente",

  "corp":"Corporación",

  "displaycorp":"MostrarCorporación",

Ex. Without:

  "resultsperpage":"Resultados / Página",

  "customer":"Cliente",

  "corp":"Corporación",

  "displaycorp":"Mostrar Corporación",
有帮助吗?

解决方案

Use the second approch.

Make absolutely sure you always use the same encoding when programmatically reading or writing to file, or when doing http.

Never rely on the default encoding of your system(s). Always specify your chosen encoding.

Make absolutely sure you always edit these files in the correct encoding.

The encoding itself does not matter. I recommed utf-8 over ISO 8859-1 or others.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top