2

i have star micronics tsp650 and im implementing SDK in my app, but i cant print the € symbol

someone knows what is the code to print it?

Thanks

2 Answers 2

2

Finally STAR MICRONICS support answer me

the code to print € symbol is

[commands appendBytes:"\x1b\x1d\x74\x04"
               length:sizeof("\x1b\x1d\x74\x04")-1]; //meto Euro

[commands appendBytes:"\xD5"
               length:sizeof("\xD5")-1]; //meto euro
3
  • did you faced the problem with £ symbol ? Aug 10, 2016 at 6:55
  • 1
    @GaurangMakwana to print the £ sign use: [commands appendBytes:"\x1b\x1d\x74\x03\x9c" length:sizeof("\x1b\x1d\x74\x03\x9c")];
    – Eeshwar
    Aug 19, 2016 at 14:17
  • Link for anyone wanting the £ symbol stackoverflow.com/questions/38865680/…
    – Joel Davey
    Mar 22, 2017 at 10:34
0

€ in hex byte values:
UTF16: 20AC
UTF8: E2 82 AC

char utf8[]  = "\xE2\x82\xac";
char utf16[] = "\x20\xAC";
NSLog(@"utf8:  %@", [[NSString alloc] initWithBytes:utf8 length:3 encoding:NSUTF8StringEncoding]);
NSLog(@"utf16: %@", [[NSString alloc] initWithBytes:utf16 length:2 encoding:NSUTF16BigEndianStringEncoding]);

NSString *cost = @"156.95 \xE2\x82\xac\r\n"; // dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"Cost: %@", cost);

NSMutableData *commands = [NSMutableData new];
[commands appendData:[@"156.95 \xE2\x82\xac\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
NSLog(@"commands: %@", commands);

NSLog output:

utf8:  €  
utf16: €  
cost: 156.95 €   
commands: <3135362e 393520e2 82ac0d0a>
6
  • but how to put? \x20ac? or \xe282ac? Jun 18, 2014 at 23:49
  • Dont works, here is my code: [commands appendData:[@"156.95 \xE2, \x82, \xac \x20, \xAC \r\n" dataUsingEncoding:NSASCIIStringEncoding]]; Jun 18, 2014 at 23:59
  • nope :( still doesnt works, with UTF8 dont print the symbol, with utf16 error conversion to input utf8 Maybe is some other ascii code? Jun 19, 2014 at 0:10
  • I have added the code you are using as an example. The Euro symbol can not be represented in ASCII so NSASCIIStringEncoding can not be used, NSUTF8StringEncoding must be used. Also only utf8 hex can be used in string literals, not utf16 or utf32.
    – zaph
    Jun 19, 2014 at 0:31
  • If i put: [commands appendData:[@"156.95 \xE2\x82\xac \r\n" dataUsingEncoding:NSUTF8StringEncoding]]; It print another extrange symbol, maybe is printer encription problem Jun 19, 2014 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.