Skip to content

Use mb_convert_encoding when encoding detected, else try utf8_encode #112

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 12, 2016

Conversation

stefandoorn
Copy link
Contributor

Basically I was getting an error sometimes:

mb_convert_encoding(): Illegal character encoding specified

It happened that the mb_detect_encoding call was returning FALSE in some cases, which in turn let mb_convert_encoding raise an error.

Small adjustment made to only use mb_convert_encoding in case there is a encoding known. The SimpleXmlElement object creation was not working in the same case when it was not converted to UTF-8, therefor the utf8_encode call is introduced. I'm only performing both in the situation mb_convert_encoding is available, as we only did transform things when this function exists. I can't test it very well what would happen in the case it ain't available.

@gabrielbull I think this is safe to do (and works better in my set-up), but could you also have a look?

@gabrielbull
Copy link
Owner

That looks safe to me, good job on maintaining the project! 🌟

@stefandoorn stefandoorn merged commit 09b6519 into master Jul 12, 2016
@ptondereau ptondereau deleted the quickfix/encoding-issue branch September 14, 2020 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants