Bug 47179 - [PATCH] hsmf - Enconding error when using POIFSChunkParser on Linux
[PATCH] hsmf - Enconding error when using POIFSChunkParser on Linux
Product: POI
Classification: Unclassified
Component: POIFS
PC Linux
: P2 critical (vote)
: ---
Assigned To: POI Developers List
Depends on:
  Show dependency tree
Reported: 2009-05-11 01:38 UTC by BUREAU Nicolas
Modified: 2009-05-16 12:12 UTC (History)
0 users

changes to StringChunk class (1.17 KB, patch)
2009-05-11 01:38 UTC, BUREAU Nicolas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description BUREAU Nicolas 2009-05-11 01:38:25 UTC
Created attachment 23638 [details]
changes to StringChunk class

Changes to the StringChunk class

This applies to the hsmf component in the scratchpad area.

The setValue method in StringChunk class uses default platform encoding to convert stream parameter into String. This conversion doesn't work when the OS is Linux.

The solution was to test chunk type and set encoding used to convert the Stream to String :
  - if type is "NEW_STRING" (indeed Unicode) : we set encoding to "UTF16-LE"
  - if type is "OLD_STRING" : we set encoding to "CP1252"
Comment 1 Nick Burch 2009-05-16 12:12:28 UTC
Thanks for this. Applied to svn with a few tweaks.