01-21-2009, 02:21 PM
|
#1 (permalink)
|
|
Registered Member
Join Date: Nov 2008
Posts: 130
|
how to get UTF-16 from NSString
I have a line of code:
const char *cStr = [clearText UTF8String];
and I want to get the utf16string instead, but can't find an easy way to do this. I know NSString uses UTF-16 internally so I can't figure why this is so difficult.
|
|
|
01-21-2009, 02:35 PM
|
#2 (permalink)
|
|
New Member
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
|
It's not difficult.
Code:
const char *cStr = [clearText cStringUsingEncoding:NSUnicodeStringEncoding];
Note: You may need NSUTF16BigEndianStringEncoding or NSUTF16LittleEndianStringEncoding instead of NSUnicodeStringEncoding.
|
|
|
06-25-2009, 12:22 PM
|
#3 (permalink)
|
|
Registered Member
Join Date: Jun 2009
Posts: 14
|
can you please tell the difference between :
NSUTF16BigEndianStringEncoding, NSUTF16LittleEndianStringEncoding and NSUnicodeStringEncoding
I am trying to port a windows code, which was actually using WCHARs.
TIA
Vibhor
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 445 |
| 49 members and 396 guests |
| activ8, AdyCoder, Cathy, chinhminhdo, codeMonkey, crabFish, csnplt, DaveHolzer, dda, DorkyMohr, Eagle11, endy13, GarLe722, ggalante, gjosef, gomugroup, greenuns, Gudus, hawksz, healthyutech, hyang, imsatasia, iPhoneDevelopment, Jeremy1026, Jupiterus, Kryckter, learnSomething, luigi1977, mgales, mobi_dev, PeddlePower, Picoman, rocotilos, Sckah, scotopia, seriessix, soga, sojourner, StevenD, tateyaku, themathminister, tralhavet, treazer, TunaNugget, vcanic, Vivek Nirkhe, ZunePod |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,496
Threads: 35,780
Posts: 156,745
Top Poster: smasher (2,448)
|
| Welcome to our newest member, GarLe722 |
|