riesenia / pohoda

XML generator a parser pre Pohodu
34 stars 30 forks source link

Pass encoding to the open method #24

Closed jvitasek closed 3 years ago

jvitasek commented 3 years ago

This fixes the problem parser error : Input is not proper UTF-8, indicate encoding !

segy commented 3 years ago

zdravim. mozem sa spytat, v akom pripade toto vznikne? lebo aj ked na pohodu nahram XML v utf-8, vypluje na mna naspat windows-1250 a so spravnou hlavickou, co musi XMLReader vyhodnotit spravne. cize neviem, preco by sme mu chceli indikovat vstup v inom kodovani.

jvitasek commented 3 years ago

@segy Hi, for me it happens when I receive something like note="export z�sob" in the XML, which only happens in one of my projects but people from Stormware were unable to fix it for some reason. Edit put forth in this pull request solves this, casting it into the right encoding..

It would help me a lot if you merged this, since I would otherwise need to clone this package and use it outside of Composer.

segy commented 3 years ago

mohol by som este poprosit tu odpoved z pohody? idealne kompletny xml subor. vdaka.

jvitasek commented 3 years ago

@segy Sorry, I'm not at liberty to divulge that data. As I said before, there are various � tags all throughout the file. This is the flow:

  1. Pohoda sends stock data via XML (HTTP request)
  2. The script saves this data into a file
  3. A cronjob parses the file using your library and that's where the error happens (parser error : Input is not proper UTF-8, indicate encoding !)

Obviously, it would be fixed if Pohoda sent valid UTF-8 data in the first place, but they don't :)

jvitasek commented 3 years ago

@segy I would like to add that we are using a stock export customized by Stormware (since the client's version does not support automatic HTTP exports), so maybe that's why you did not run into the same problems when working with Pohoda.

segy commented 3 years ago

v tom exporte ma nezaujimali data. chcel som si len potvrdit hypotezu, ze v tom xml exporte chyba korektna hlavicka. to ale nie je dovod na takuto upravu kodu.