[Nexus-developers] UTF-8 strings and NAPI

Peter.Chang at Diamond.ac.uk Peter.Chang at Diamond.ac.uk
Mon Oct 25 13:56:02 BST 2010


Hi all,

With the standardization(?) that strings in NeXus should be UTF-8, has
anyone check through and tested the handling of such strings?

Looking through the NAPI code, I noticed that the string and character
handling does not cope with UTF-8. In particular, getinfo and getdata
call nxitrim which assumes ASCII as I don't think you can process UTF-8
in reverse. Maybe it's best to forget about striping white space from
strings... Also the number of bytes does not equal the number of
characters and so should be emphasized.

Also the examples Ex1.7 and Ex1.8 (the latter is wrong in the generated
html!) in the Core-API doc shows some padding of string data with the +2
in their makedata call. What's the opinion on the padding and the
requirement for NULL-termination in C? I think the data format should
not have NULL-padding but the API should correctly terminate or remove
termination (as Mark K and other said in a 5-year old debate on this
list).

Regards,
 Peter


-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 






More information about the NeXus-developers mailing list