Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
1
Erster Beitrag:
vor 8 Jahren, 5 Monaten
Beteiligte Autoren:
Jimbo

W-Language Upper(..)

Startbeitrag von Jimbo am 19.04.2009 07:31

Hi,

for French & English languages, Upper(..) seems to be correct. However, other languages may show serious problems with Upper(..). In German, Upper(..) translates the Umlaut-characters ÄÖÜ to AOU, the ß (which corresponds to a spoken ss) isn't transformed at all. The problem are the 'extended ASCII Codes' 128 - 255 which can be varied for different languages. Here's a small & simple function which can be altered easily for other non-Unicode character sets:


PROCEDURE MyUpper(Text is string)
Text1 is string

FOR I = 1 TO Length(Text)
SWITCH Middle(Text,I,1)
CASE "a" TO "z"
Text1 += Charact(Asc(Middle(Text,I,1))-32)
CASE "ä"
Text1 += "Ä"
CASE "ü"
Text1 += "Ü"
CASE "ö"
Text1 += "Ö"
CASE "ß"
Text1 += "SZ"
CASE "é"
Text1 += "É"
CASE "è"
Text1 += "È"
CASE "ç"
Text1 += "Ç"
OTHER CASE
Text1 += Middle(Text,I,1)
END
END

RESULT Text1



Note 1: ß is transformed to two characters SZ

Note 2: Setting an Input mask of the Edit control to UPPER CASE + DIGITS magically returns the correct upper case characters ÄÖÜ while Upper(..) doesn't work properly! Seems, that the Edit Control's function is built on top of M$ API CharUpperBuff(..) while Upper(..) is a home brewd function.

Note 3: There's a Windows API function as well, CharUpperBuff(..) http://msdn.microsoft.com/en-us/library/ms885165.aspx which converts character strings to upper case. Here, the language settings of the current Windows will be taken into account and you have to accept whatever Microsoft decides to be an upper case character of your lower case ones.

Note 4: the function above allows you to force alternative ways of making characters upper case, which, in German, would involve to translate ä to AE, ö to OE, ü to UE and ß to SS which enables easier / unified searching functions. Secondly, you are independent of the computer settings, running German language software under a Hungarian Windows will not return big problems.

Kind regards,
Guenter

Antworten:

Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.