Replacing in UTF-8
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