Re: Evaluating Double Byte
Re: Evaluating Double Byte
- Subject: Re: Evaluating Double Byte
- From: Christopher Nebel <email@hidden>
- Date: Tue, 5 Feb 2008 14:30:20 -0800
On Feb 5, 2008, at 1:36 PM, email@hidden wrote:
Sure, I am using my main application to pull data to be inserted in
a Word Document.
thus pulling dynamic text in insert into preformed applescript code
i.e.
insert text "pulled text from db here" at text object of selection
This works fine until I come across any Japanese, Chinese, ect.
languages, which I can test if they are and then wrap them in code
such as:
insert text "pulled text " & «data utxt1575» as Unicode text & "from
db here" at text object of selection
however, when the NSApplescript event attempts to pass that to
applescript, it seems to not recognize the chevrons. It will
replace them with what looks like a different character.
not sure if this was what you were looking for (nor if I made a lot
of sense for that matter ;) ), but it seems I need to find a way to
pass the string to applescript without using the chevrons.
No, you just need to tell the truth about what encoding you're using.
If you ever see characters changing, it's a sign that there's a
disagreement between the encoding you're using and the one the system
is using. Leopard is much better about this sort of thing in many
respects. It properly handles non-ASCII characters in @"..." literals
(Tiger doesn't, and it'll warn you about them), and AppleScript itself
is Unicode-aware, so you don't have to muck around with chevrons --
you can just put the literal character in the source text.
Of course, if you're really just doing a one-line command, then you
should check out trying to send the Apple event directly and not using
AppleScript in the first place. You can roll the entire thing
yourself using NSAppleEventDescriptor, but most people find that kind
of painful, so have a look at appscript (third-party, requires Panther
or better) or Scripting Bridge (built into Leopard).
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden