[ome-users] wrong encoding returned by dumpXML

David Gault (Staff) d.gault at dundee.ac.uk
Wed Oct 17 14:41:46 BST 2018


Hi Steve,

Thanks for sending in the report and welcome to the community. I attempted to reproduce the problem but was unable to get the fatal error to occur, my Matlab did seem to use ISO-8859-1 as the default character set though.

The dumpXML call should be returning a String from https://github.com/dgault/ome-common-java/blob/master/src/main/java/loci/common/xml/XMLTools.java#L252 which is set to be encoded with UTF-8 https://github.com/dgault/ome-common-java/blob/master/src/main/java/loci/common/Constants.java#L40.
Do you think it is possible that using char to convert it has changed the encoding?
Does setting the character set in Matlab correct it? For example using : feature('DefaultCharacterSet', 'UTF-8’)

With Thanks,
David Gault

On 16 Oct 2018, at 17:49, Stephen D. Van Hooser <vanhoosr at brandeis.edu<mailto:vanhoosr at brandeis.edu>> wrote:

Hi all -

I'm new to the Open Microscopy effort but it looks really nice, thank you.

It's always dangerous to post a bug as one's first message, but I think there's a bug in dumpXML. I'm using Matlab, but it tells me that the object is loci.formats.ome.OMEXMLMetadataImpl

If I call

r = bfGetReader('~/Downloads/myfile.lif');
m=r.getMetadataStore();
x = char(m.dumpXML()); % char converts Java string to Matlab character string
str2text('myfilename.xml',x); % my own function that simply writes text files https://github.com/VH-Lab/vhlab-toolbox-matlab.git
s = xml2struct('myfilename.xml')


I get a fatal error because the encoding type described in opening of the xml string in x is UTF-8 but the actual encoding of the document is iso-8859-1. If I edit the x string manually, it can be processed correctly.


Best
Steve




------------------------------------------
Stephen D. Van Hooser, PhD

Associate Professor of Biology
Brandeis University
781-736-2721 (phone)
{www<http://www.vhlab.org/>,wiki<http://wiki.vhlab.org/>,code<http://code.vhlab.org/>,dataclass<http://dataclass.vhlab.org/>,twitter<https://twitter.com/VanHooserLab/>}.vhlab.org<http://vhlab.org/>

_______________________________________________
ome-users mailing list
ome-users at lists.openmicroscopy.org.uk<mailto:ome-users at lists.openmicroscopy.org.uk>
http://lists.openmicroscopy.org.uk/mailman/listinfo/ome-users


The University of Dundee is a registered Scottish Charity, No: SC015096
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openmicroscopy.org.uk/pipermail/ome-users/attachments/20181017/1f132cbd/attachment.html>


More information about the ome-users mailing list