• 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: Re: Strange character changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Strange character changes


  • Subject: Re: Re: Strange character changes
  • From: "W. Thomas Leroux" <email@hidden>
  • Date: Mon, 30 Oct 2006 15:58:17 -0500

Thanks Emmanuel

I did try what you suggested:
write write_to_disk to fileID as string

Which I thought, from your explanation would work, but for some odd
reason, it didn't.

It also just butchered : Delerium (Featuring The Mediæval Bæbes) into
Medi¾val B¾bes.

I added as string to this line - to see if it would help:
set write_to_disk to current_song & " - " & current_artist & return as string

But, unfortunately, no dice.. or in this case, correct characters.

I did try opening it in various UTF-16 formats, but I get what appears
to be Chinese or Japanese characters - I also tried the UTF-8 formats,
which yielded better results, but still presented the special
character problem.

Any more ideas?

Thomas.

On 10/30/06, Emmanuel <email@hidden> wrote:
At 1:39 PM -0500 10/30/06, W. Thomas Leroux wrote:
>I've written a little applescript that takes the currently playing
>song name and artist name and writes them to disk
>
>However, I noticed that names with "odd" characters show up oddly, for
>example, Björk gets saved as Bjsrk
>
>Relevant code:
>
>
>set current_song to (name of current track) as string
>set current_artist to (artist of current track) as string
>set write_to_disk to current_song & " - " & current_artist & return
>
>set fileID to open for access file file_location with write permission
>set eof of fileID to 0
>write write_to_disk to fileID
>close access fileID
>
>Any suggestions?

Most probably write_to_disk is a Unicode string. When it stores a
Unicode string, AppleScript writes by default a UTF-16 file. This is
somehow very surprising - and very logical at the same time - and
it's normal that non-specialists be bitten.

So, I think you must choose either to read the file as UTF-16
(TextEdit can do that), or to write the file as Mac-Roman, with:

write write_to_disk to fileID as string

Emmanuel
 _______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden



--
All about me!
http://www.leroux.ca
_______________________________________________
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/mailman//archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Strange character changes
      • From: kai <email@hidden>
    • Re: Strange character changes
      • From: Peter Baxter <email@hidden>
References: 
 >Strange character changes (From: "W. Thomas Leroux" <email@hidden>)

  • Prev by Date: Excel Selection
  • Next by Date: Re: Excel Selection
  • Previous by thread: Re: Strange character changes
  • Next by thread: Re: Strange character changes
  • Index(es):
    • Date
    • Thread