Character encoding: Difference between revisions

From FreeMind
Jump to navigationJump to search
No edit summary
No edit summary
Line 10: Line 10:


==Implementation==
==Implementation==
Reading:
* Class FileReaderCreator in MindMapMapModel uses UTF-8 as the character encoding: 'return new UnicodeReader(new FileInputStream(mFile), "UTF-8");'
* Class FileReaderCreator in MindMapMapModel uses UTF-8 as the character encoding: 'return new UnicodeReader(new FileInputStream(mFile), "UTF-8");'
* The above class is instantiated in MindMapMapModel.loadTree(final File) method.
* The above class is instantiated in MindMapMapModel.loadTree(final File) method.
* Which is called from MindMapMapModel.load(File file).
* Which is called from MindMapMapModel.load(File file).
* Class UnicodeReader determines the encoding from byte order mark (BOM), if any; it seems to take the passed-in "UTF-8" in case there is no BOM.
* Class UnicodeReader determines the encoding from byte order mark (BOM), if any; it seems to take the passed-in "UTF-8" in case there is no BOM.
Writing:
* XMLElement.writeEncoded() encodes Unicode points such that unicode < 32 or unicode > 126 as XML character entities.


Links:
Links:
* [https://sourceforge.net/p/freemind/code/ci/master/tree/freemind/freemind/modes/mindmapmode/MindMapMapModel.java MindMapMapModel.java], sourceforge.net
* [https://sourceforge.net/p/freemind/code/ci/master/tree/freemind/freemind/modes/mindmapmode/MindMapMapModel.java MindMapMapModel.java], sourceforge.net
* [https://sourceforge.net/p/freemind/code/ci/ae2e0364a92e71de2f85d3ba1ae2129a5736985d/tree/freemind/freemind/common/UnicodeReader.java UnicodeReader.java], sourceforge.net
* [https://sourceforge.net/p/freemind/code/ci/ae2e0364a92e71de2f85d3ba1ae2129a5736985d/tree/freemind/freemind/common/UnicodeReader.java UnicodeReader.java], sourceforge.net
* [https://sourceforge.net/p/freemind/code/ci/master/tree/freemind/freemind/main/XMLElement.java XMLElement.java], sourceforge.net


==Tracker items==
==Tracker items==

Revision as of 15:41, 6 June 2023

FreeMind stores Unicode characters as XML character entities into mind map files.

Reading of UTF-8 encoded mind map files is supported, with or without UTF-8 byte order mark (BOM).

Reading of UTF-32BE, UTF-32LE, UTF-16BE and UTF-16LE seem to be all supported provided the mind map starts with byte order mark (BOM).

Writing of UTF-8 is probably not supported; there was a feature request for this.

FreeMind does not write any BOM natively; given it writes XML character entities, it would make no sense.

Implementation

Reading:

  • Class FileReaderCreator in MindMapMapModel uses UTF-8 as the character encoding: 'return new UnicodeReader(new FileInputStream(mFile), "UTF-8");'
  • The above class is instantiated in MindMapMapModel.loadTree(final File) method.
  • Which is called from MindMapMapModel.load(File file).
  • Class UnicodeReader determines the encoding from byte order mark (BOM), if any; it seems to take the passed-in "UTF-8" in case there is no BOM.

Writing:

  • XMLElement.writeEncoded() encodes Unicode points such that unicode < 32 or unicode > 126 as XML character entities.

Links:

Tracker items

Limitations

  • There is no or little support for XML declaration at the top of the mind map file; to be tested and clarified.
  • Probably no writing in UTF-8, as per above.

See also