Hi Marc,
Wish this thread existed 2 years ago. :-) But I digress..
You may also consider using the alternative approach of getting the
user to select the most readable encoding (after you've tried
automatically detecting it) and floating the most appropriate/most
frequently used encodings on to
Sorry, I misread your suggested method, but, as Adam points out, it still isn't
adequate for someone who has free-styled 8-bit text with no idea what the
original encoding was.
>
>On Wednesday, May 07, 2008, at 12:37PM, "Jean-Daniel Dupas"
><[EMAIL PROTECTED]> wrote:
>>What make you think this
On Wednesday, May 07, 2008, at 12:37PM, "Jean-Daniel Dupas" <[EMAIL PROTECTED]>
wrote:
>What make you think this function assumes an exact encoding ? This
>method is not the same than +[NSString
>stringWithContentsOfFile:encoding:error:].
>
>The method +stringWithContentsOfFile:usedEncoding:
What make you think this function assumes an exact encoding ? This
method is not the same than +[NSString
stringWithContentsOfFile:encoding:error:].
The method +stringWithContentsOfFile:usedEncoding:error: returns the
sniffed encoding by reference using the second argument. At least
that'
No, that's not the same thing. The method you suggest assumes an exact
encoding; the sniffer functions from TextEncodingConverter look at the data to
see if it follows the patterns appropriate for a suggested set of encodings and
lets you know which one would be the best match. Typically, such
More modern and more Cocoa way? You mean something like this +
[NSString stringWithContentsOfFile:usedEncoding:error:] ;-)
«Discussion
This method attempts to determine the encoding of the file at path.»
Le 7 mai 08 à 19:33, Gary L. Wade a écrit :
If you're interested in determining the bes
If you're interested in determining the best encoding match for text, look at
the TextEncodingConverter.h header, which has functions related to encoding
sniffing. There may be more modern techniques available, but I had used that
almost a decade ago in a formerly major web browser. It's not p
On May 6, 2008, at 9:22 PM, Jens Alfke wrote:
On 6 May '08, at 10:45 AM, Aki Inoue wrote:
Actually, I don't recommend using CP1252 as the generic fallback
encoding like this.
The encoding does have gaps, and the handling of those invalid gaps
varies between conversion engines. CF/NSStrin
On 6 May '08, at 10:45 AM, Aki Inoue wrote:
Actually, I don't recommend using CP1252 as the generic fallback
encoding like this.
The encoding does have gaps, and the handling of those invalid gaps
varies between conversion engines. CF/NSString treat the invalid
bytes strictly and return n
On May 6, 2008, at 10:56 AM, Jens Alfke wrote:
On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:
As the OP wants to create NSStrings with data created by his
application I'm pretty sure he will not want the the Windows
encoding - unless he parses text documents originating from Windows.
On Tue, May 6, 2008 at 10:45 AM, Aki Inoue <[EMAIL PROTECTED]> wrote:
>
> On 2008/05/06, at 8:56, Jens Alfke wrote:
>
>
> >
> > On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:
> >
> >
> > > As the OP wants to create NSStrings with data created by his application
> I'm pretty sure he will not wa
On 2008/05/06, at 8:56, Jens Alfke wrote:
On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:
As the OP wants to create NSStrings with data created by his
application I'm pretty sure he will not want the the Windows
encoding - unless he parses text documents originating from Windows.
He
On 6 May '08, at 7:03 AM, Thomas Engelmeier wrote:
As the OP wants to create NSStrings with data created by his
application I'm pretty sure he will not want the the Windows
encoding - unless he parses text documents originating from Windows.
He didn't say where the data originates from, or
On 05.05.2008, at 18:20, Jens Alfke wrote:
I find it safest to go with the Windows encoding, because it's a
superset of both ASCII and ISO-Latin-1 that maps all 256 characters,
so it never returns nil. It's also the default encoding on Windows,
so there's a lot of text out there in the wil
On 5 May '08, at 5:17 AM, Marc Lohse wrote:
A C function that i'd like to use returns an array
of UInt8 and i simply don't find out how to convert
this into a NSString...
It depends on what the encoding of the C string is. In the general
case, use
[NSString stringWithCString: ... e
+[NSString stringWithUTF8String:] is what you're looking for. I
*think* UInt8 and char are always the same size, but I'm not 100% sure
if you can always depend on that. If you can, you can just feed your
UInt8 array to the function.
Hope this helps,
Hank
On May 5, 2008, at 8:17 AM, Marc Lo
Hello,
i am quite a newbie to objective-c and c and hence
have to ask this certainly stupid newbie question.
A C function that i'd like to use returns an array
of UInt8 and i simply don't find out how to convert
this into a NSString...
Is there anybody willing to point me in the right
direction?
17 matches
Mail list logo