Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Handle the third argument of mb_convert_encoding() being an array #52

Closed
wants to merge 3 commits into from
Closed

Handle the third argument of mb_convert_encoding() being an array #52

wants to merge 3 commits into from

Conversation

leofeyer
Copy link
Contributor

@leofeyer leofeyer commented Oct 8, 2015

This PR fixes #51.

if (0 === strncmp($enc, 'ISO-8859-', 9)) {
return $enc;
}
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't need this in the default case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean the break;?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeh

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what's the purpose of this whole change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

array('ASCII', 'ISO-2022-JP', 'UTF-8', 'ISO-8859-1')

Without the change, the method would return false for ISO-2022-JP, even though the list contains more, valid charsets. After the change, the unknown charset is ignored, so the list can be run trough until the end and return the correct charset.

@nicolas-grekas
Copy link
Contributor

looks good thanks, I'll merge it today

@nicolas-grekas
Copy link
Contributor

Closed via 5b09e07
Thank you @leofeyer

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Third argument of mb_convert_encoding() can be an array
3 participants