estratocloud / edifact

Parser and Serializer for UN/EDIFACT messages in PHP
Apache License 2.0
35 stars 9 forks source link

serialize() changes the UNA segment #7

Closed nerdoc closed 2 weeks ago

nerdoc commented 5 years ago

As you have more or less the same code, it will affect you too. If using a custom UNA segment with non-standard characters, create a simple message and serialize it again, Serializer.serialize() will just create a standard UNA header and overwrite it. See my bug: https://github.com/nerdocs/pydifact/issues/11

I added a check - please have a look at my python code - you unconditionally add the UNA header when serializing - which is bad when a custom character set is used.

duncan3dc commented 2 weeks ago

Hi @nerdoc, great to hear from you! I've been following your project and the vibrant community you've created :slightly_smiling_face:

The way I handle a custom UNA segment is by passing a ControlCharacters instance to the serializer (https://github.com/estratocloud/edifact/commit/f8f6a80b247430e7ed06c730e7517c951debcffa) so my library doesn't support manually creating a UNA

nerdoc commented 1 week ago

Ok! thanks!