• 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: What is this invisible character?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What is this invisible character?


  • Subject: Re: What is this invisible character?
  • From: "J. Todd Slack" <email@hidden>
  • Date: Wed, 19 Mar 2008 10:04:33 -0700
  • Thread-topic: What is this invisible character?

Hi All,

I am still working on this after a night of sleep. The original Author used
Applescript and it has been a while since I have worked with AS.

I think that he is calling this when he writes out the file.

set the target_file to the target_file as text
        set the open_target_file to open for access file target_file with
write permission

        if new_file is true then write (ASCII character of 254) & (ASCII
character of 255) to open_target_file

        write this_data to the open_target_file starting at eof as Unicode
text
        close access the open_target_file
        return true

I think that my problem when I write new files back out is that I don't
write an ASCII Characters and I am using UTF versus Unicode.

How do I write an ASCII 254 and ASCII 255 at the beginning of the NSString
that I am putting in the file I want to be read back in at a later date? '

-Jason


On 3/18/08 10:47 PM, "Jens Alfke" <email@hidden> wrote:

>
> On 18 Mar '08, at 9:53 PM, J. Todd Slack wrote:
>
>> So how do I write out a text file in UTF16-BE encoding? Maybe this
>> would
>> solve my problem.
>
> You *are* writing it out in that encoding; that's the problem. It's
> not the default text encoding, so apps won't interpret the text
> correctly. You generally want to save text files in UTF-8.
>
>> if ([predefinedSessionDocumentsFileContents writeToFile:
>> pathToUsersImpressionDocumentsSessionFile atomically: YES]) {}
>>        else { NSLog (@"Failure writing Documents Session File On
>> Startup");
>> }
>
> You want -writeToFile:atomically:encoding: instead. Pass
> NSUTF8StringEncoding as the last parameter.
>
> (I'm kind of surprised that the method you're calling generates
> UTF-16. Maybe that's part of the reason it's marked as deprecated!)
>
> ‹Jens



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: What is this invisible character?
      • From: Jens Alfke <email@hidden>
    • Re: What is this invisible character?
      • From: "stephen joseph butler" <email@hidden>
References: 
 >Re: What is this invisible character? (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Unable to access an instance properties and methods
  • Next by Date: NSString may not respond....
  • Previous by thread: Re: What is this invisible character?
  • Next by thread: Re: What is this invisible character?
  • Index(es):
    • Date
    • Thread