Menu

#2 Bug when unserializing string with accent chars

v1.0_(example)
open
nobody
None
5
2016-01-14
2010-10-25
paranoid
No

I found a problem when trying to unserialize a string cointaining several accent characters like ó, Á, ú inside a serialized array of arrays (ArrayList). I found this problem occurs in both NET and CFNET.

The lib discard the character following the accent char and then some elements are read wrong. I have commented out some lines of code inside the Unserialize function.

I am uploading the Serializer.cs file with this change. Only with this I could get the correct input array after the Unserialize call. Only the Unserialize function was tested.

Discussion

  • paranoid

    paranoid - 2010-10-25

    Serializer class with some code commented out to prevent character discard after accent char.

     
  • Matt Palmerlee

    Matt Palmerlee - 2012-04-09

    Sorry that I've taken so long to look at this. I've just posted a new version (07) with another fix to support long serialization/deserialization, I've changed the tester to default to have the accent characters in the test, and it works for me, note that when you serialize/deserialize strings, the number is the byte count, not the character count, so when you serialize: Á it should be: s:2:"Á" not: s:1:"Á"

    So I think the code how it stands is correct, give it a try again and let me know if you still have problems.

     
  • Tom Vanassche

    Tom Vanassche - 2016-01-14

    I came across the same problem, and I was using the latest release (07). However, I can confirm that the code itself works perfectly indeed.

    For me, the problem occured when I simply used the prebuilt "PHPSerializationLibrary.dll" library that is bundled in the download for the latest release (found in folder "CSPHPSerial\PHPSerializationLibrary\PHPSerializationLibrary\bin\Release").

    I assumed that this DLL would be the correct version, but in fact it is an older version of the library. The prebuilt DLL is version 1.0.0.1 and does not work correctly with accented chars, while recompiling the code results in a DLL with version 1.0.0.7 which works perfectly.

    Perhaps it might be prudent to reupload version 07 with the correct prebuilt DLL, so others don't run into the same problem (some might think the library doesn't work correctly).

    edit corrected a typo

     

    Last edit: Tom Vanassche 2016-01-14

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.