Adgarza

Joined 31 January 2023
Revision as of 13:27, 21 April 2019 by Adgarza (talk | contribs) (Convert from Unicode to ASCII)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Task
Adgarza
You are encouraged to solve this task according to the task description, using any language you may know.

Convert unicode special characters to ASCII.

In Spanish language, there are accented and special characters like á, é, í, ó, ú, ü, ñ (all low case and upper case), as so signs to open a question (¿) and admiration (¡). There are many other special characters in other languages, but for the sake of this exercise you can only concentrate in the Spanish ones.

All this characters look weird when you read a text file like this (Spanish) in a DOS program:

"¡Ah, qué calor! ¡Cómo me haría falta una buena soda! Pero mañana tengo que 
entregar esta tarea y ánimas que me alcance el tiempo para ello. ¿Cómo me 
iría si entregase al último?"

(This translates into: "Oh, how hot! How I would need a good soda! But tomorrow I have to deliver this task and I hope to have enough time for it. What could happen to me if I am the last one to deliver it?")

The resulting text in DOS reads like this: Screenshot of Unicode Spanish text in standard DOS program

The task is to write a code able to convert from Unicode to ASCII. Following you'll find text lines to convert:

  • ¡Ah, qué calor!
  • ¡Cómo me haría falta una buena soda!
  • Mañana tengo que entregar esta tarea y ánimas que me alcance el tiempo para ello.
  • ¿Cómo me iría si entregase al último?
  • Árbol que crece torcido, su tronco jamás endereza.
  • Camarón que se duerme, se lo lleva la corriente.
  • El murciélago voló anoche, como todo el año.
  • Es rica el azúcar de caña.
  • ¿Te ha gustado el ejercicio?

Would be desirable to do the contrary (from ASCII to Unicode).