[pyicu-dev] how does one use a .nrm file ?

Andi Vajda vajda at osafoundation.org
Mon Apr 19 16:26:15 PDT 2010


On Mon, 19 Apr 2010, Andi Vajda wrote:

> I have a file called utr30.nrm that was produced by ICU 4.4's gennorm2 on a
> big endian ultra60 workstation.
>
> I then put this file into a .dat file via:
>
>   $ echo utr30.nrm | gencmn -v -n utr30 0
>
> I then use udata_setAppData("utr30", "utr30.dat") which appears to succeed.
> How do I use that app data then with Normalizer2's getInstance() method ?
> What are the packageName and name parameters supposed to be then ?

After much poking around, reverse engineering, looking at ICU's Makefiles,
I found that the following works:

  $ echo utr30.nrm | gencmn -v -n utr30 0  # big endian since utr30.nrm is
  $ icupkg -tl utr30.dat ../utr30.dat      # convert to little endian

   then in Python, using the newest, little endian, utr30.dat if you are
   on a little endian platform

  >>> ResourceBundle.setAppData("utr30", "utr30.dat")
  >>> Normalizer2.getInstance("utr30", "utr30", UNormalizationMode2.COMPOSE)

I'm not sure that this is the best way but it seems to work.

Andi..


More information about the pyicu-dev mailing list