Umlaut--Success!

Devin Asay devin_asay at byu.edu
Thu Mar 1 14:19:26 EST 2007


On Mar 1, 2007, at 10:02 AM, Mark Schonewille wrote:

> Hi Devin,
>
> This doesn't work for me (Mac OS X 10.4.8, Rev 2.7.8).
>
> The # is replaced by n instead of n-umlaut.

Right, after I sent this message, I discovered that the first # in  
the field does not get replaced by the n-umlaut, only an n. It works  
for every other # after the first one. (Go figure!) Here's a  
workaround that worked for me:

on mouseUp
   get "#"&fld "poundfld"
   put numToChar(110) & numToChar(204) & numToChar(136) into tChars
   replace "#" with tChars in it
   set the unicodeText of fld "result" to uniencode(it,"UTF8")
   delete char 1 to 2 of fld "result"
end mouseUp

Does this work for you?

Thanks for keeping me honest!

Devin

>
>> Signe,
>>
>> You can still do it without one of these methods. Let's take your  
>> case as an example. Say you have a field "poundfield" that  
>> contains your text with # for each n-umlaut. Now create another  
>> field, say field "result", and set its textFont to a unicode font  
>> as in #1 of my first post, below. Now create a button with the  
>> following script:
>>
>> on mouseUp
>>   get fld "poundfld"
>>   replace "#" with "nÃà" in it
>>   set the unicodeText of fld "result" to uniencode(it,"UTF8")
>> end mouseUp
>>
>> Barring any automatic Mac to PC character substitutions (by Rev or  
>> by your mail client,) this should result in the #'s in your  
>> poundfield being replaced by the character you want. If it doesn't  
>> work as posted here, the three characters in the 'with' part of  
>> the replace statement are ASCII-110 ASCII-204 ASCII-136. So you  
>> could generate them reliably by doing this:
>>
>> on mouseUp
>>   get fld "poundfld"
>>   put numToChar(110) & numToChar(204) & numToChar(136) into tChars
>>   replace "#" with tChars in it
>>   set the unicodeText of fld "result" to uniencode(it,"UTF8")
>> end mouseUp
>>
>> Hope this saves you from a kludge. ;-)
>>
>> Devin
>>
>> On Mar 1, 2007, at 1:38 AM, Signe Marie Sanne wrote:

Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list