A LOT of people have asked questions about putting Spanish text into Centricity and no one has answered. We also don't have an answer, but I wanted to put our situation out there and see if anyone has any ideas.
We have an external app that was built in house that has options for Spanish text. We then have a Centricity form that pulls that text into the text translation, but when we display it in the Text Translation, the wrong characters are displayed.
Here's what we've figured out: If our external app contains an "ñ" (ASCII character 241), the text translation displays "ñ" (ASCII characters 195 and 177). We can't figure out why it misinterprets one character as two.
The DOCDATA table in the database contains the wrong ASCII characters in hex for both of these, and the "ñ" is also displayed as two characters (c3 b1). Our thought is to pull in the text from the external app, then in the code window of the MEL form, find the wrong ASCII characters and use set() to swap them for the correct ones.
Running the MEL trace, we were able to see that our numtoascii() functions were returning the correct characters, but the swaps still aren't being made. It looks like there's a chance that the swap is being made, but the text translation is still returning "ñ" as "ñ", even after the change has been made.
Has anyone done anything like this at all? Any ideas of what we could be missing? I'll continue to update this thread with our progress, and will ultimately post our solution to help out anyone who's looking to translate and return something in Centricity.
I just stumbled across this post, and I was wondering how things were going. My team was told to never use special characters, and we've just stuck with that, even though unfortunately the accent marks are needed. When I receive the Spanish translations from our translators, I go through and remove any special characters. I can always tell if I've missed something, because like you said, “ñ” appears and someone complains.
So I guess it turns out I did exactly the thing I was complaining about at the beginning of my post...
As a quick recap, we were pulling data from an external, homemade application, so this may need some tweaking in order for it to work for you. This function lives in a Text Component that is paired with our Care Plan form, which took some hunting to ultimately find and figure out (I don't get the point of Text Components, but if someone wants to proselytize, please do!) Finally, our solution was weird, in that the ASCII assignments for the special characters were not actually represented in ASCII... So you may need to do a little leg work to determine what the incoming characters are.
Here was our ultimate solution:
{
fn eng2span(text) {
local CPText1 = ""
local convText = ""
local textArray = ""
local pos = ""
/*These variables are all the special characters turned into ASCII values*/
local char_a = numtoascii(225)
local char_e = numtoascii(233)
local char_i = numtoascii(237)
local char_n = numtoascii(241)
local char_o = numtoascii(243)
local char_u = numtoascii(250)
for i = 1, i <= 2001, i = i + 1 do
local replaceChar = ""
pos = match(text, numtoascii(195))
if pos == 0 then
break
else
endif
text = remove(text, pos, 1)
/*These case statements all search for broken characters, turn them to ASCII codes (you see they're all negative...) and then swaps them for the variables assigned above*/
cond
case asciitonum(sub(text, pos, 1)) == -95 replaceChar = char_a
case asciitonum(sub(text, pos, 1)) == -87 replaceChar = char_e
case asciitonum(sub(text, pos, 1)) == -83 replaceChar = char_i
case asciitonum(sub(text, pos, 1)) == -79 replaceChar = char_n
case asciitonum(sub(text, pos, 1)) == -77 replaceChar = char_o
case asciitonum(sub(text, pos, 1)) == -70 replaceChar = char_u
else
continue
endcond
text = set(text, pos, replaceChar)
endfor
for i = 1, i <= 2001, i = i + 1 do
pos = match(text, numtoascii(194))
if pos == 0 then
break
else
endif
text = remove(text, pos, 1)
endfor
return text
}
}
We called this function in the other functions that we use to pull the text from the the external program and to display it in the text translation. I hope this helps! Please let me know if you, or anyone else, has any questions. This was hard work, and hopefully this can be used to help make that work easier for anyone else.