• 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
Replacing in UTF-8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Replacing in UTF-8


  • Subject: Replacing in UTF-8
  • From: Vince <email@hidden>
  • Date: Fri, 4 Mar 2005 15:22:32 +0100

Hi!

(How) Is it possible to replace in utf-8 text?

I tried the following:

# # #
--This doesn't work:
set this_text to read (choose file) as «class utf8»
(*
This works:
set this_text to "mytest" as «class utf8»
*)
display dialog (this_text, "test", "foobar"))

on this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars

# # #

The format «class utf8» does not seem to be the problem. As if you have a text of «class utf8» which only contains characters that are pure Latin-1 (eg: "mytest") it works without any problems!
But If your utf-8 text contains characters such as "ƕƊƋƌƎƏ" it fails! (it returns "" instead of "ƕƊƋƌƎƏ foobar")
(For testing you have to read the utf-8 text from a file because you cannot type them in the script editor's window!)

Or is there any other way to replace with applescript in utf-8 FAST AND WITHOUT 3rd party OSAX?

Thanx
Vincent

# # #

»¿ʇı̣ əsnqɐ ʇ,uɐɔ noʎ ɟı̣
ɓuı̣ɥʇʎuɐ sı̣ pooɓ ʇɐɥʍ«
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Replacing in UTF-8
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: get current system volume / Again
  • Next by Date: Re: Xmail BCC
  • Previous by thread: Re: Why does this filter expression not work? Anyone have an idea? Hmm, doesn't work for me -- even just the filter doesn't work by itself. Gives a "descriptor type mismatch" error. I had discovered that earlier, when doing other things with colors. I thi
  • Next by thread: Re: Replacing in UTF-8
  • Index(es):
    • Date
    • Thread