• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Weird AppleScript Problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Weird AppleScript Problem


  • Subject: Re: Weird AppleScript Problem
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 05 Dec 2011 21:44:14 +1100

On 05/12/2011, at 9:03 PM, Thomas Fischer wrote:

perhaps somebody can point me to an easier and more efficient method

If you're happy to use ASObjC Runner:

script lossyASCII
set theString to current application's NSApp's convertedValue()
-- lossy conversion to ASCII data
set theData to theString's dataUsingEncoding_allowLossyConversion_(current application's NSASCIIStringEncoding, true)
-- convert back to text
return current application's NSString's alloc()'s initWithData_encoding_(theData, current application's NSUTF8StringEncoding)
end script

tell application "ASObjC Runner" to set theResult to run the script {lossyASCII} converting "Àª©çº" with result returned

0000.000 -- Start --
0000.011 Result
--> Aa(C)co

-- 
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

  • Follow-Ups:
    • Re: Weird AppleScript Problem
      • From: Bernardo Hoehl <email@hidden>
References: 
 >Weird AppleScript Problem (From: Bernardo Hoehl <email@hidden>)
 >Re: Weird AppleScript Problem (From: Thomas Fischer <email@hidden>)

  • Prev by Date: Re: Weird AppleScript Problem
  • Next by Date: SQLite and AppleScript
  • Previous by thread: Re: Weird AppleScript Problem
  • Next by thread: Re: Weird AppleScript Problem
  • Index(es):
    • Date
    • Thread