• 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: NSString looses Umlaute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSString looses Umlaute


  • Subject: Re: NSString looses Umlaute
  • From: Alexander Reichstadt <email@hidden>
  • Date: Thu, 22 Dec 2011 16:54:34 +0100

Thanks, but I  have not tried. My thinking went along the lines of if I read the string directly from the URL I have no control over what encoding is being used for reading or it defaults to something. If I first read as data, I can do with those bytes as I please. The DBF file is not in one consistent encoding from start to finish. The DBF file format documentation says the header is in binary, then there is a linefeed (\r), then there is the body. Each field has a fixed length, wether used or not doesn't matter, the unused rest is filled with spaces.

So, I read the file as data, stringily it as DOSLatin1, split it at the linefeed and read the body according to the field definitions I am given. They are guaranteed, so maybe some day I get around to writing a nice DBF parser, but until then I go by the guaranteed field lengths.

I tested it now on a couple of files and it works without a hitch.


Am 22.12.2011 um 14:40 schrieb Mike Abdullah:

>
> On 22 Dec 2011, at 09:59, Alexander Reichstadt wrote:
>
>> Thanks, it works. The following solved the problem, where theChoice is a URL to a local file from an NSOpenPanel:
>>
>>       NSData *theData = [NSData dataWithContentsOfURL:theChoice];
>>       NSString *theContent = [[NSString alloc] initWithData:theData encoding:
>>                               CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingDOSLatin1)
>>                               ];
>
> You can initialise a string directly from the contents of a URL you realise, right? Or are you saying that doesn't work, but this technique somehow does?
>

_______________________________________________

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: NSString looses Umlaute
      • From: Mike Abdullah <email@hidden>
    • Re: NSString looses Umlaute
      • From: Ken Thomases <email@hidden>
References: 
 >NSString looses Umlaute (From: Alexander Reichstadt <email@hidden>)
 >Re: NSString looses Umlaute (From: Ben Kennedy <email@hidden>)
 >Re: NSString looses Umlaute (From: Alexander Reichstadt <email@hidden>)
 >Re: NSString looses Umlaute (From: vincent habchi <email@hidden>)
 >Re: NSString looses Umlaute (From: Alexander Reichstadt <email@hidden>)
 >Re: NSString looses Umlaute (From: Vincent Habchi <email@hidden>)
 >Re: NSString looses Umlaute (From: Alexander Reichstadt <email@hidden>)
 >Re: NSString looses Umlaute (From: Jean-Daniel Dupas <email@hidden>)
 >Re: NSString looses Umlaute (From: Alexander Reichstadt <email@hidden>)
 >Re: NSString looses Umlaute (From: Mike Abdullah <email@hidden>)

  • Prev by Date: Re:Re: How to get the phone number use ios sdk in iphone.
  • Next by Date: Re: NSString looses Umlaute
  • Previous by thread: Re: NSString looses Umlaute
  • Next by thread: Re: NSString looses Umlaute
  • Index(es):
    • Date
    • Thread