• 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: Omission of % character when loading a string from a file?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Omission of % character when loading a string from a file?


  • Subject: Re: Omission of % character when loading a string from a file?
  • From: Hasan Diwan <email@hidden>
  • Date: Thu, 26 Dec 2002 14:36:11 -0500

initWithContentsOfFile assumes the file is in XML, where the '%' sign
is an "entity declaration"
(http://archive.devx.com/projectcool/developer/xmlz/xmldtd/
dtdentities.html).
On Thursday, December 26, 2002, at 01:10 PM, Jan Van Boghout wrote:

> Nope, NSLog isn't fooling me. I'm parsing css files, and my % signs are
> lost. I am trying this out with the css file I downloaded at:
> http://www.w3c.org/Style/shadows.css
> In one property there is a font size of 140%, but it comes through as
> 140. And the % isn't lost in my parsing, it's not in the string that is
> loaded in the first place either. I select a file using an open panel
> and take its path. Then I do this:
>
> css = [[NSMutableString alloc] initWithContentsOfFile:[op filename]];
>
> No % signs are in the resulting string. This is the only line of code
> that causes it, so I guess loading a string directly from a file isn't
> what I should be doing. But what should I do then? I'd think this is
> supposed to work.
>
> JVB
>
>> The second poster might be more on target. How are you verifying the
>> read contents? Try the suggestion of:
>>
>> NSLog("%s", string);
>>
>> If you already were doing that and you are still missing %s, and it
>> opens in TextEdit as plain text, then try opening it in PB to verify
>> it is plain text.
>>
>> Beyond those I would need to try playing with code or the file in
>> question.
>>
>> Michael
>>
>>
>> On Thursday, December 26, 2002, at 09:38 AM, Jan Van Boghout wrote:
>>
>>> Hmm. So encoding is the problem. It's a css file from the official
>>> W3C site, but the problem stays when making a plain text file from
>>> TextEdit. How could I get the correct file encoding and load it with
>>> that encoding?
>>>
>>>> Is the file Unicode? Does it have the unicode encoding bytes at the
>>>> front of the file? How was the file created?
>>>>
>>>> Michael Latta
>>>>
>>>> On Thursday, December 26, 2002, at 09:13 AM, Jan Van Boghout wrote:
>>>>
>>>>> Why is it that when I load a plain text file as a string, every %
>>>>> character seems to disappear completely?
>>>>>
>>>>> I use : [[NSMutableString alloc] initWithContentsOfFile:path]
>>>>>
>>>>> Every single % in that file won't be read, no matter where in the
>>>>> file
>>>>> it is. Any solutions? This is terribly annoying since I need to
>>>>> have
>>>>> those percentage signs in my file.
>>>>>
>>>>> Greetings,
>>>>>
>>>>> Jan Van Boghout
>>>>> _______________________________________________
>>>>> cocoa-dev mailing list | email@hidden
>>>>> Help/Unsubscribe/Archives:
>>>>> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>>>>> Do not post admin requests to the list. They will be ignored.
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
>
Hasan Diwan
OpenPGP KeyID: 0x7EE3855B
Fingerprint: 42F0 5758 C3EB BA1F ABD2 ED49 3390 CCF0 7EE3 855B
http://www.cs.rpi.edu/~diwanh/gpg.key

[demime 0.98b removed an attachment of type application/pgp-signature which had a name of PGP.sig]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Omission of % character when loading a string from a file?
      • From: David Remahl <email@hidden>
References: 
 >Re: Omission of % character when loading a string from a file? (From: Jan Van Boghout <email@hidden>)

  • Prev by Date: Re: *Really* Understanding Cocoa
  • Next by Date: Re: Crontab/Scheduled tasks
  • Previous by thread: Re: Omission of % character when loading a string from a file?
  • Next by thread: Re: Omission of % character when loading a string from a file?
  • Index(es):
    • Date
    • Thread