Welcome! Log In Create A New Profile

Advanced

W-Language Upper(..)

Posted by Jimbo 
Jimbo
W-Language Upper(..)
April 19, 2009 09:31AM
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(..) [msdn.microsoft.com] 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




Edited 3 time(s). Last edit at 04/19/2009 09:39AM by Jimbo.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: