Umlaut--Success!

Devin Asay devin_asay at byu.edu
Thu Mar 1 10:38:17 EST 2007


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:

> Hello Devin,
>
> I'm afraid none of the methods can be used. I have lots of texts in  
> which I use "#" for the n with umlaut. These will be fed into  
> fields on the fly appearing with the correct letter instead of the  
> "#". So far I have used images for various text sizes which work  
> reasonably well. My problem arose when I wanted to select a line in  
> the text, then having to change the colour of the image as well. So  
> I think I'll stick to the images, just double the sets of images  
> with selection colours as well.  Thanks for all the help from you  
> and Mark.
>
> Signe Marie Sanne
>
> Den 28. feb. 2007 kl. 18:57 skrev Devin Asay:
>>  You *can* do this in Rev. Here's how I did it in OS X (I'm using  
>> rev 2.8 in OSX 10.4.8):
>>
>> 1. Create a field and set its textfont to a unicode font:
>>   set the textFont of fld "unistuff" to "Verdana,unicode"
>>
>> 2. Enable the Unicode Hex Input method in the International system  
>> prefs under the input tab. This will cause the Unicode Hex Input  
>> method to appear in the input menu (the one with the little flags  
>> on the right side of the menubar.)
>>
>> 3. Position the insert cursor in the field, choose Unicode Hex  
>> Input from the input menu, then type :
>>   n (then, holding alt/option key down) 0308
>>
>>   the n with umlaut should appear.
>>
>> Sorry, don't know how to do this via direct input in Windows.  
>> However, the following should work on either OS:
>>
>> 1. Create a UTF-8 encoded text file that includes the desired  
>> character. I used BBedit, making sure I chose a font that  
>> supported unicode (Tahoma or Lucida Grande should work) and that  
>> the document encoding was set to UTF-8, then created the n-umlaut  
>> character just as I described in #3 above.
>>
>> 2. Save the file to disk.
>>
>> 3. Read it in to your rev fld using the uniencode() function.
>>
>> I've created a stack that shows how to do this.
>>
>> go stack url "http://revolution.byu.edu/unicode/testUnicode.rev"
>>
>> You may also want to download the utf-8 file from http:// 
>> revolution.byu.edu/unicode/textUni.ut8. This is the file that the  
>> sample stack reads from.


Devin Asay
Humanities Technology and Research Support Center
Brigham Young University




More information about the use-livecode mailing list