• 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
Length of string as UTF-8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Length of string as UTF-8


  • Subject: Length of string as UTF-8
  • From: Tom Robinson <email@hidden>
  • Date: Sun, 6 Aug 2006 21:29:47 +1200

Hi people,

Is there a way to get the length of a Unicode string as it would be represented in UTF-8?

I have an AppleScript which uses Unicode strings, which I then write to a file. I need to keep the files under 4096 bytes for displaying on an iPod.

e.g.:

set a to "don’t" as Unicode text -- that's a right single curly quote

log length of a -- This returns 5, but underlying AS it's probably 10 (the quote being U2019)

log length of (a as «class utf8») -- This still returns 5, but I'd like something similar to this which returns 7 (the quote being UTF-8 e2 80 99)

Thoughts?

Cheers _______________________________________________
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: Length of string as UTF-8
      • From: Axel Luttgens <email@hidden>
    • Re: Length of string as UTF-8
      • From: Yvan KOENIG <email@hidden>
  • Prev by Date: Newbie here - need a simple script. Help appreciated!
  • Next by Date: Find text with shell script
  • Previous by thread: Newbie here - need a simple script. Help appreciated!
  • Next by thread: Re: Length of string as UTF-8
  • Index(es):
    • Date
    • Thread