PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Sonia Cruz on March 03, 2021, 02:47:21 PM

Title: Text file with international characters & symbols how to translate to English US
Post by: Sonia Cruz on March 03, 2021, 02:47:21 PM
Hello all!
Do you know how and when detect special characters contained in rows of a text file coming from international symbols of, for example, addresses of Europe, South America, etc., how to translate / convert them to character code equivalent to the English (United States) language? This is for an electronic file that the format do not accept special characters and symbols.   
Thanks in advance!
Regards
Sonia Cruz
Title: Re: Text file with international characters & symbols how to translate to English US
Post by: Ken Sproul on March 04, 2021, 03:48:40 PM
There are a few ways to tackle this.  Check out the tbl= read option and table directive, the translate directive, and the tbl() function.


Manual links:
https://manual.pvxplus.com/PXPLUS/directives/read.htm
https://manual.pvxplus.com/PXPLUS/directives/table.htm
https://manual.pvxplus.com/PXPLUS/directives/translate.htm
https://manual.pvxplus.com/PXPLUS/functions/tbl.htm
Title: Re: Text file with international characters & symbols how to translate to English US
Post by: Devon Austen on March 05, 2021, 11:01:24 AM
If the international symbols are Unicode (UTF-8,UTF-16) you can pass in the input text through the CVS() function and convert to ASCII. This still allows for some international symbols which are part of ASCII though. If your problem is non ASCII then CVS will work for you.

CVS(inputText$,"UTF8:ASCII")

https://manual.pvxplus.com/?functions/cvsextend.htm