riesenia / pohoda

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

cp1250/Utf8 problem #18

Closed Vitexus closed 3 years ago

Vitexus commented 3 years ago

Hi, i want use Windows-1250 encoded input, It work in most cases, but https://github.com/riesenia/pohoda/blob/master/src/Pohoda/Common/OptionsResolver.php#L69 use hardcoded Utf-8

return \mb_substr($value, 0, $param, 'utf-8');

Which make use of other encodings inpossible.

stancl commented 3 years ago

Can you do something like this?

$this->response->addHeader('Content-Type: text/xml; charset=windows-1250');
$this->response->setOutput($this->pohoda->close());
Vitexus commented 3 years ago

Hallo, @stancl at least i push data into mServer using only pure unicode XML

        \Riesenia\Pohoda::$encoding = 'UTF-8';

Thus there is no need to convert anything. Fortunately Pohoda is accepting

<?xml version="1.0" encoding="UTF-8"?>

My original problem was in understaning to Pohodas's documentation. I'd think that cp1250 is only encoding i can use.