Skip to Navigation | Skip to Content

Ref_impl_Java mailing list archives

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: testParsingWithoutUTF8Encoding Error


Hi Sebastian,

This is a very good option. It will be nice if the new API wouldn't break existing code in other components. Perhaps change the original class ADLParser to something else and name the new interface ADLParser with the same kind of constructors. Then in the default constructor of the new class, we instantiate the real parser with UTF encoding.

Cheers,
Rong

On 9 February 2010 15:22, Sebastian Garde <sebastian.garde@oceaninformatics.com> wrote:
Hi,

I agree and like it too, but haven't found a straightforward way of doing this:

The constructor taking an InputStream only is generated automatically by JavaCC, which sends it to the constructor with encoding=null specified

  public ADLParser(java.io.InputStream stream) {
     this(stream, null);
  }

This constructor therefore is fairly unsafe to use because it just assumes the system's default encoding.

Maybe we can hide it using this approach, which I think would be a breaking change though:
http://www.pisolutions.eu/node/11

Rong may have a far better idea how to change this behaviour.


Cheers
Sebastian


Fábio Nogueira de Lucena wrote:
Hi Sebastian, Rong

there is a third option to consider: when ADLParser is used with only one argument the encoding used can be UTF-8 instead of the one used by the platform. In this case, no change to the tests are needed. But documentation should state clearly that UTF-8 is used when no specific encoding is provided. This is in accordance with "Support Information Model", page 18, section 3.3.1.1 which states: "... In openEHR, UTF-8 encoding is assumed". 

Cheers,

Fábio
_______________________________________________
Ref_impl_java mailing list
Ref_impl_java@openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/ref_impl_java