Skip to content
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

Weird encoding for Brazil city names #23

Open
noriods opened this issue Jul 21, 2020 · 2 comments
Open

Weird encoding for Brazil city names #23

noriods opened this issue Jul 21, 2020 · 2 comments

Comments

@noriods
Copy link

noriods commented Jul 21, 2020

Thanks for a great package! It works well for generating a list of Brazillian states.

I'm just struggling with the cities. This doesn't work:

Countries::where('name.common', 'Brazil')
  ->first()
  ->hydrateCities()
  ->cities
  ->where('adm1name', 'Amapá')
  ->pluck('name')
  ->toArray();

But this does:

Countries::where('name.common', 'Brazil')
  ->first()
  ->hydrateCities()
  ->cities
  ->where('adm1name', 'Amapá')
  ->pluck('name')
  ->toArray();

I'm on Laravel 7, PHP 7.4.

What can I change in what I'm doing to get it to filter the cities by the state name?

@noriods
Copy link
Author

noriods commented Jul 21, 2020

It seems like data/cities/default/bra.json has an encoding problem.

It has this for São Paulo: S\u00c3\u00a3o Paulo

Whereas data/states/default/bra.json has this: S\u00e3o Paulo (Which works.)

Hope this helps.

@krutyosila
Copy link

utf8_decode($value)

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

No branches or pull requests

2 participants