Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I couldn't get this to work.</p> <p>I has a html string with <code>&amp;nbsp;</code> NON BREAKING SPACE</p> <pre><code>&lt;/div&gt;Great Guildford St/SouthwarkSt &amp; nbsp;Stop:&amp; nbsp; BM&lt;br&gt;Walk to SE1 0HL&lt;br&gt; "Great Guildford St/SouthwarkSt \U00a0Stop:\U00a0 BM", </code></pre> <p>I tried 3 types of encode/decode</p> <pre><code>// NSData *asciiData = [instruction dataUsingEncoding:NSUTF16BigEndianStringEncoding]; // NSString *asciiString = [[NSString alloc] initWithData:asciiData // encoding:NSUTF16BigEndianStringEncoding]; // NSData *asciiData = [instruction dataUsingEncoding:NSASCIIStringEncoding]; // NSString *asciiString = [[NSString alloc] initWithData:asciiData // encoding:NSASCIIStringEncoding]; //little endian NSData *asciiData = [instruction dataUsingEncoding:NSUTF16LittleEndianStringEncoding]; NSString *asciiString = [[NSString alloc] initWithData:asciiData encoding:NSUTF16LittleEndianStringEncoding]; </code></pre> <p>none of these worked. They seemed to work as if I NSLog the string it looks ok </p> <pre><code>NSLog(@"HAS UNICODE :%@", instruction); ..do encode/decode NSLog(@"UNICODE AFTER:%@", asciiString); </code></pre> <p>Which output</p> <pre><code>HAS UNICODE: St/SouthwarkSt  Stop:  BM UNICODE AFTER: St/SouthwarkSt  Stop:  BM </code></pre> <p>but I happened to store these in an NSArray and I happened to call <code>[stringArray description]</code> and all the unicode was still in there</p> <pre><code>instructionsArrayString: ( "Great Guildford St/SouthwarkSt \U00a0Stop:\U00a0 BM", "Walk to SE1 0HL" ) </code></pre> <p>So something in NSLog hides <code>&amp;nbsp;</code> but it shows up in NSArray description so you may think youve removed the Unicode when you haven't.</p> <p>Will try another method that replace the characters.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload