Skip to content

[1.7][maxmind] fix provider encondig. Force utf8. - #268

Merged
willdurand merged 2 commits into
geocoder-php:1.7from
formapro-forks:maxmind-binary-fix-encoding
Oct 18, 2013
Merged

willdurand merged 2 commits into
geocoder-php:1.7from
formapro-forks:maxmind-binary-fix-encoding

Conversation

@makasim

@makasim makasim commented Oct 15, 2013

Copy link
Copy Markdown
Contributor

No description provided.

@Baachi

Baachi commented Oct 15, 2013

Copy link
Copy Markdown
Member

Why not encode the whole file? This has some performance and memory issues.

@makasim

makasim commented Oct 15, 2013

Copy link
Copy Markdown
Contributor Author

@Baachi could explain how binary file could be encoded?

@Baachi

Baachi commented Oct 16, 2013

Copy link
Copy Markdown
Member

Hm this is a good question. I just google the problem and everyone suggest to use utf8_encode or mb_convert_encoding.

@makasim

makasim commented Oct 16, 2013

Copy link
Copy Markdown
Contributor Author

too many failed tests. I believe it is not me.

@Baachi

Baachi commented Oct 16, 2013

Copy link
Copy Markdown
Member

The tests didn't pass because the data from the differend providers has been changed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know if it works, but i think array_walk_recursive('utf8_encode', $results) would work too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Honestly saying I copy\pasted it from another Provider.

I dont think we need array_walk_recursive here as the array created few lines above and it contains scalars.

@makasim

makasim commented Oct 16, 2013

Copy link
Copy Markdown
Contributor Author

@willdurand any chance to merged it?

@willdurand

Copy link
Copy Markdown
Member

Do we really need this?

@makasim

makasim commented Oct 16, 2013

Copy link
Copy Markdown
Contributor Author

@willdurand just comment the fix and see how the test would fail

@willdurand

Copy link
Copy Markdown
Member

But the lib should not alter the encoding...

@makasim

makasim commented Oct 16, 2013

Copy link
Copy Markdown
Contributor Author

But the lib should not alter the encoding...

well, yes in a perfect world. Here it is well known problem. As far as I can see it is the only one solution to get the right info.

First I tried to fix encoding in the project code but it appeared to be too late, it simply did not work. Somewhere after MaxmindBinaryProvider and before project code it is completely corrupted (I did not debug so I cannot say where exactly).

Also I found that you did exact same fix in the GeoIpProvider.

@willdurand

Copy link
Copy Markdown
Member

Also I found that you did exact same fix in the GeoIpProvider.

Ah, then I'm screwed! :D

So, could you create a fixEncoding() method to the AbstractProvider and relies on it in both GeoIpProvider and MaxmindBinaryProvider?

@makasim

makasim commented Oct 17, 2013

Copy link
Copy Markdown
Contributor Author

@willdurand

So, could you create a fixEncoding() method to the AbstractProvider

done - formapro-forks@3c90e66

willdurand added a commit that referenced this pull request Oct 18, 2013
[1.7][maxmind] fix provider encondig. Force utf8.
@willdurand
willdurand merged commit ddb35bf into geocoder-php:1.7 Oct 18, 2013
@willdurand

Copy link
Copy Markdown
Member

Great, thanks!

@willdurand

Copy link
Copy Markdown
Member

Tagged 1.7.1

@makasim
makasim deleted the maxmind-binary-fix-encoding branch October 18, 2013 07:32
@makasim
makasim restored the maxmind-binary-fix-encoding branch October 18, 2013 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants