Accent is missing in French character of "e"
Hi,
English word ="Other anemias" It is converted to french as printing "Autres anemies".But correct word is " Autres anémies".I wrote a program in the cache. But did not get the correct output.So How to solve this issue
tstr(string,map)
s map=$lb(192,194,196,199,201,200,202,203,206,207,212,214,217,219,220,215,224,226,228,231,233,232,234,235,238,239,244,246,249,251,252,247,193,195,197,198,208,209,222,223,204,205,210,211,172,216,174,221,225,227,229,230,240,241,254,255,236,237,242,243,188,248,190,253,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,222,191,224,225,226,227,228,213,218,231,232,233,234,235,236,237,190,239,240,241,242,243,244,245,250,247,248,249,250,251,252,253,254,255)
s string="Autres anemies"
s length = $l(string)
f i=1:1:length {
s c = $a($e(string,i))
if (c >= 128 && c <= 255) {
s chars = string
f j=i:1:length {
s $e(chars,j) = $c($$tchar($a($e(chars,j)),map))
q $e(chars,j)
}
}
}
tchar(c,map)
s retval = c
s:(c >= 128 && c <= 255) retval=$lg(map,(c-128))
q retval
At least please notice that Caché ObjectScript does not have operator precedence.
Instead of
if (c >= 128 && c <= 255) {
you should write
if (c >= 128) && (c <= 255) {
the same with
s:(c >= 128 && c <= 255) retval=$lg(map,(c-128))
I have no idea what your code is really trying to do. Some comments would be helpful. Même un commentaire en français serait utile. In addition to adding parenthesis needed because COS does not have operator precedence. Also,
1. $a($e(string,i)) is unnecessary, $a(string,i) does the same thing.
2. You are obviously doing some kind of translation. Look at $ZCONVERT() in the documentation.
3. For other simple translation, $TRANSLATE() is a simple solution. For example if you have old data in AFNOR NF Z 62010-1982, you could translate it to Unicode with $TRANSLATE(string,"#'@[\]`{|}~","£’à°ç§µéùè¨").