0

I am working on writing a native app written in Kotlin and compiled with the GraalVM. Part of this requires me to open and manage spreadsheets (xlsx).

When I run the app in vm mode using any JVM, including Graal, everything works fine. However, when I compile the app native, I get an error when I attempt to open the same excel file as the one I open in the JVM. For the record, I am using apache POI

UnsupportedCharsetException: CP1252

Can someone explain why it works in JVM mode but not native?

a snippet of the stacktrace:

java.lang.ExceptionInInitializerError: null
        at org.apache.poi.poifs.filesystem.FileMagic.<init>(FileMagic.java:133) ~[pikr:5.2.3]
        at org.apache.poi.poifs.filesystem.FileMagic.<clinit>(FileMagic.java:74) ~[pikr:5.2.3]

And the code in question in POI:

    FileMagic(String... magic) {
        this.magic = new byte[magic.length][];
        int i=0;
        for (String s : magic) {
            this.magic[i++] = s.getBytes(LocaleUtil.CHARSET_1252);
        }
    }
Christian Bongiorno
  • 5,150
  • 3
  • 38
  • 76

1 Answers1

2

Try adding -H:+AddAllCharsets to your command line.

There must be some way to add a few specified charsets only, but I cannot find it in the options (native-image --expert-options-all)

peterz
  • 306
  • 1
  • 3