Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
CREATE DATABASE openmrs
  DEFAULT CHARACTER SET utf8
  DEFAULT COLLATE utf8_general_ci;

...

The java Properties class has two methods (load() and store()) that don't support UTF-8, that were used in a couple of places, most notably when loading message string files. There are now alternate methods that you can use in OpenmrsUtil that preform the same function, but read and write using UTF-8.

Reading in UTF-8 files

There is an interested Java issue involving reading in a UTF-8 file.  Some applications (including Microsoft Notepad) add a special character called a byte order mark to the beginning of a UTF-8 file, but Java's standard encoding doesn't support this:

http://bugs.sun.com/view_bug.do?bug_id=4508058

As a workaround, you can wrap a file input stream in an org.apache.velocity.io.UnicodeInputStream instance, which is specifically designed to be BOM-aware.  (There is also a BOMInputStream in apache.commons.io, but in a later version of the jar than is included in Openmrs 1.6).