Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'Bad' characters from AS Studio text fields



   Hello,
     This was an excellent suggestion, as was the one speculating that the problem was the use of the term "contents" instead of the preferred (in a handler) "content." However, neither suggestion solves the issue that anything taken from a text field or text view, even when coerced to "string," returns so-called bad characters, whereas straight vanilla AS strings do not return such characters.


email@hidden wrote:

>Text fields actually use Unicode texts, not strings.  AppleScript (or  
>the text field object, not too sure on the internals) is coercing it  
>for you.  If you then set a variable to the text field's contents, it  
>will be a unicode text, and barring a new coercion to a string, will  
>send "bad characters" (eg, the text in the wrong encoding) to the  
>central database.  When just putting anything between two quotes,  
>AppleScript will assume its a string (which, in the case of AppleScript  
>Studio, I *really* wish they'd change to a defaul of Unicode text, and  
>allow UTF-16 source code files).
>
>To coerce them out, just say something like
>
>set txtByline to (contents of "txtByline" of window "winStory") as  
>string
>
>Parentheses might not be necessary.
>
>Matthew Stuckwisch
>Senior, Spanish and New Media
>University of Alabama
>
>On Mar 22, 2005, at 11:40 AM, Jim Trebilcock wrote:
>
>
>
>> Hello,
>>      I've run into an interesting snag while porting my OS 9  
>> AppleScript-based programs to AS Studio.
>>      One program my reporters use standardizes "slugs" (story names)  
>> and inserts byline coding when stories are created in our central  
>> database. In my AS Studio version of this longstanding program, any  
>> text that has been entered in an AS studio text field is reported as  
>> having "bad characters" by our database. If I hardcode the string in  
>> my AS Studio program  and avoid the text fields (set txtByline to "Jim  
>> Trebilcock" instead of  set txtByline to contents of text field  
>> "txtByline" of window "winStory"), this works fine and the database is  
>> happy.
>>       Question: What is being returned by AS Studio text fields that  
>> is NOT being returned by a vanilla AppleScript string? How can I  
>> coerce these items out of the byline (and other) strings when read  
>> from an AS studio text field?
>>      Thanks
>>
>>
>> --  
>> email@hidden
>>
>> __________________________________________________________________
>> Switch to Netscape Internet Service.
>> As low as $9.95 a month -- Sign up today at  
>> http://isp.netscape.com/register
>>
>> Netscape. Just the Net You Need.
>>
>> New! Netscape Toolbar for Internet Explorer
>> Search from anywhere on the Web and block those annoying pop-ups.
>> Download now at http://channels.netscape.com/ns/search/install.jsp
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Applescript-studio mailing list       
>> (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/applescript-studio/guifa% 
>> 40charter.net
>>
>> This email sent to email@hidden
>>
>
>
>
>


-- 
email@hidden

__________________________________________________________________
Switch to Netscape Internet Service.
As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

Netscape. Just the Net You Need.

New! Netscape Toolbar for Internet Explorer
Search from anywhere on the Web and block those annoying pop-ups.
Download now at http://channels.netscape.com/ns/search/install.jsp
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.