OS2World OLD-STATIC-BACKUP Forum

OS/2 - SIGs => Rexx => Topic started by: Fahrvenugen on 2011.08.17, 23:53:47

Title: Detecting french accents
Post by: Fahrvenugen on 2011.08.17, 23:53:47
I've got a REXX script where a portion of it I use the TRANSLATE function to strip out unwanted characters from a string and replace them with nothing.  The code looks like:

sentence = TRANSLATE(sentence,"","/-?&`!().,")

Essentially the output of this script gets pushed to another utility that has difficulties with some of these characters, so I strip them out first.

Recently I've run into a situation where the sentence variable can end up with a french accent character.  I'd like to be able to add these characters into the translate command so they also get stripped out.

Does anyone know how to add this type of character so REXX will recognize it?

Thanks
Title: Re: Detecting french accents
Post by: ivan on 2011.08.18, 02:13:48
Wouldn't that need some sort of search and replace function otherwise you will end up with some strange words if you just take out accented letters and leave blanks.

ivan
Title: Re: Detecting french accents
Post by: Fahrvenugen on 2011.08.18, 16:46:48
That's a good point, you could use the Translate command to replace the accented characters with non-accented ones, that would work too.  But I'm still in the situation where I need to figure out how to get REXX to recognize those characters.  I'm not sure how to have REXX identify them in the code.

Title: Re: Detecting french accents
Post by: Joachim on 2011.08.18, 17:59:32
Quote from: Fahrvenugen on 2011.08.18, 16:46:48
That's a good point, you could use the Translate command to replace the accented characters with non-accented ones, that would work too.  But I'm still in the situation where I need to figure out how to get REXX to recognize those characters.  I'm not sure how to have REXX identify them in the code.

Depending on the codepage you can just 'use' them. See the attached sample scripts, one can translate from and to html entities, the other upper/lowercase. The caveat is that this probably only works in the proper codepage. But istr this can be set in REXX too.

Regards,

Joachim
Title: Re: Detecting french accents
Post by: Fahrvenugen on 2011.08.22, 18:18:11
Thanks, that's the type of thing I have been looking for!