0

i'm trying to add a UNICODE character to NSString in this ways:

NSString *euFormatted = [NSString stringWithFormat:@"\u200A%@",self.eu];

or

unichar hairspaceChar = 0x200A; // hairspace symbol
NSString* hairSpace = [[NSString alloc] initWithCharacters:&hairspaceChar length:1];
NSString *euFormatted = [NSString stringWithFormat:@"%@%@",hairSpace,self.eu];

But not results ... i try to find a solution but is making me crazy since 3 days.

I have try also to set the Font of UILabel that show the string like that:

bigFont = [UIFont fontWithName:@"Helvetica" size:10.0f];

but no way, the HAIRSPACE is not supported.

here a screenshot if what i see, the HAIRSPACE suppose to be after the NUMBER 10 and BEFORE the '°' character.

enter image description here

Denis Bulgarini
  • 143
  • 3
  • 11
  • 1
    how do you mean _no results_? have you logged the `NSString`? what does the console show? which font-set do you use to show the special character? does the font-set support it? – holex May 14 '13 at 12:41
  • I'm using the default system apple font. No results i mean that is not adding any character inside the string. – Denis Bulgarini May 14 '13 at 12:53
  • the `Helvetica-Regular` and `Helvetica-Oblique` support it well, the other type of `Helvetica` does not (including the `Helvetica Neue`). – holex May 14 '13 at 12:57
  • You can put raw unicode chars in a NSString in your source code. `NSString *test = @"I’m an  and we’re ★s"` works, so if you insert a hairspace it should work out of the box. – Cyrille May 14 '13 at 13:26
  • But where i can find a raw HAIRSPACE character? that's the point. – Denis Bulgarini May 14 '13 at 13:40
  • Found [here](http://la.remifa.so/unicode/unicode.php?start=2000&end=206F) and [here](http://www.publicsource.apple.com/source/X11proto/X11proto-57/fontconfig/fontconfig-2.8.0/fonts.conf.in), the HAIRSPACE in Helvetica is very small, in others Fonts is bigger. So that why is not possible to see a big difference. i will go for puntuaction space. – Denis Bulgarini May 14 '13 at 13:50

2 Answers2

0

If i try

NSLog(@"%@", [NSString stringWithFormat:@"-\u200A-"]);

i get '- -'.

second example will not work.

peko
  • 11,267
  • 4
  • 33
  • 48
0

Found solution: Apple supported Characters and row UTF8 Characters

The HAIRSPACE is too small, i will go for Punctuation Space that is a bit Bigger and visible,

Denis Bulgarini
  • 143
  • 3
  • 11