ebics-client-php
ebics-client-php copied to clipboard
Invalid character caused by utf8_encode
Hi,
My xml contains invalid characters due to the use of utf8_encode
in method Data::getContent()
.
Example : "München" becomes "München" and request will be rejected by bank server.
Is it really necessary to use utf8_encode
?
Best regards
I think that this utf8_encode is used because XML encoding is utf8.
@maisoui if you find, that utf8_encode is breaking the request, then I think we can remove encoding.
In case of code and passed string is already in unicode, utf8_encode will break the request. I will try to add an encoding detection before utf8_encode.
No need. Because we generating document in the code. Thus we already know it encoding.
This utf8_encode was added specially for values with umlauts.
I guess this litlle snippet can do the job.
//ensure content is unicode encoding
if (!mb_check_encoding($content, 'UTF-8')) {
$content = utf8_encode($content);
}
(will be included in my incoming pull request)
Regards
Better to shift the logic for encoding values into Transfer document builder.
agree
fixed in #146 :)
Tested with real transactions for all umlauts:
Max Mußtermann
Ää-Öö-Üü-Custom-Name