4

I need to convert strings with diatrics to as ASCII version of it.

As an example the string “Caicó” is converted to “Caico” and “À bientôt” is converted to “A bientot”. It’s a usual problem with lots of European languages that uses diactrics to decorate a regular Latin letter to change its pronunciation.

The problem is when a database is inputted with ASCII (regular) encoding and you need to compare it with Unicode characters.

The function TO_ASCII works perfectly fine in PostegreSQL for the Portuguese language. Any idea of a similar function on Oracle or a better approach to compare such strings in Oracle?

Rafael Borja
  • 4,487
  • 7
  • 29
  • 33

3 Answers3

2

Would something like this be suitable? perhaps wrap it in a function?

SELECT CONVERT(TRANSLATE('Ä Ê Í Ó Ø A B C D E ã Ã ã Ã'
   ,'ãÃ','aA')
   ,'US7ASCII','WE8ISO8859P1') from dual
Jeffrey Kemp
  • 59,135
  • 14
  • 106
  • 158
0

The function below works fine in Oracle for almost all characters in Portuguese language, but it doesn't work for the character ‘ã’ or ‘Ã’

SELECT CONVERT('Ä Ê Í Ó Ø A B C D E ã Ã','US7ASCII','WE8ISO8859P1') from dual
Rafael Borja
  • 4,487
  • 7
  • 29
  • 33
0

Try to use

SELECT CONVERT('Ä Ê Í Ó Ø A B C D E ã Ã', 'us7ascii', 'ee8mswin1250') FROM DUAL

This will remove characters ‘ã’ or ‘Ã’.

Sid Sousa
  • 31
  • 3