Re: Omission of % character when loading a string from a file?
Re: Omission of % character when loading a string from a file?
- Subject: Re: Omission of % character when loading a string from a file?
- From: Jan Van Boghout <email@hidden>
- Date: Thu, 26 Dec 2002 19:10:56 +0100
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.