nnjeim / world

A Laravel package which provides a list of the countries, states, cities, currencies, timezones and languages.
MIT License
761 stars 104 forks source link

Some city strings are malformed #3

Closed kabacs closed 2 years ago

kabacs commented 2 years ago

While exploring your package I came across this anomaly - there is no space between words in data on the database tables. All country, state, and city names are like this.

nnjeim commented 2 years ago

@kabacs Hi, can you please share some screenshots? thank you

kabacs commented 2 years ago

Hi, this is my code, in this case returning all cities from Portugal:

Screenshot 2021-11-09 at 09 01 48

The output from this request is then:

Screenshot 2021-11-09 at 09 02 03

For example, the ID 90434, the name should be "Angra do Heroísmo", as with ID 90441, the name should be "Calheta de São Jorge", etc.

Also detected this with "United Kingdom", ex:

Screenshot 2021-11-09 at 09 06 45

In this case, the output will be:

Screenshot 2021-11-09 at 09 07 28

But if the string is together:

Screenshot 2021-11-09 at 09 08 23

The output then is:

Screenshot 2021-11-09 at 09 08 56

(Notice that the string in the names do not have spaces between them)

Thank you, Ricardo Cabanelas

nnjeim commented 2 years ago

@kabacs Thank you for all the above. At first, the name of the country in the database is only used for filtering and in the return, the name is localized by taking into consideration the locale set in the HTTP header. I would filter by the iso field like:

'filters' => ['iso2' => 'FR']

Regarding the states and city names, the issue was fixed, i thank you for the patience you took to report this. I am updating the version to 1.0.5

kabacs commented 2 years ago

@nnjeim thanks for the awesome package, plan on using it in production.