TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

#FORMAT {%A} for non ASCII character

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
Slysven



Joined: 10 Apr 2011
Posts: 365
Location: As "Jomin al'Bara" in WoTMUD or Wiltshire, UK

PostPosted: Tue Jul 31, 2012 11:57 am    Post subject: #FORMAT {%A} for non ASCII character Reply with quote

We have recently gained the %A option to #FORMAT that converts the first character of the supplied argument to a numeric value - but what should happen if that character is a UTF-8 (or BIG-5) encoded character or even not a (7-bit) ASCII character?

A quick test indicates that a signed value is returned which seems to be the value of the first byte of the supplied argument (e.g. the broken vertical bar symbol which encodes at \xC2\xA6 with UTF-8 encoding returns -62 which, I think, would be 194 {\xC2} if the value was unsigned?) The question though is: "is this useful as there is no way to retrieve the remaining bytes"? Should there be? And how?
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Tue Jul 31, 2012 4:45 pm    Post subject: Reply with quote

Probably should return an unsigned value. I guess I can return a 4 byte integer value for UTF-8 characters. Then you'd use $result % 256 to get the value of the first byte. $result / 256 % 256 for the second byte, etc.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Bug Reports All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group