Navigation Menu

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

How to remove the valid character from the name #42

Closed
sajuptpm opened this issue Feb 15, 2014 · 14 comments
Closed

How to remove the valid character from the name #42

sajuptpm opened this issue Feb 15, 2014 · 14 comments

Comments

@sajuptpm
Copy link

On top of Country, region and state name, I can see some invalid character like -.
How to remove that invalid character "-"

Example

Arunāchal Pradesh
Bihār
Chandīgarh
Karnātaka
Mahārāshtra

@sajuptpm
Copy link
Author

I am getting following error because of that invalid characters.

ERROR

UnicodeEncodeError: 'ascii' codec can't encode character u'\u0101' in position 4: ordinal not in range(128)

Example (Name of regions)

[u'Andaman and Nicobar Islands', u'Andhra Pradesh', u'Arun\u0101chal Pradesh', u'Assam', u'Bengal', u'Bih\u0101r', u'Chand\u012bgarh', u'Chhattisgarh', u'D\u0101dra and Nagar Haveli', u'Daman and Diu', u'Goa', u'Gujar\u0101t', u'Haryana', u'Himachal Pradesh', u'Jharkhand', u'Karn\u0101taka', u'Kashmir', u'Kerala', u'Laccadives', u'Madhya Pradesh', u'Mah\u0101r\u0101shtra', u'Manipur', u'Megh\u0101laya', u'Mizoram', u'N\u0101g\u0101land', u'NCT', u'Orissa', u'Pondicherry', u'Punjab', u'Rajasthan', u'Sikkim', u'Tamil N\u0101du', u'Tripura', u'Uttar Pradesh', u'Uttarakhand']

@sajuptpm
Copy link
Author

I don't need these accented chars in the name. How to remove that ?
How to remove them while populating the django_cities_light tables?

@jpic
Copy link
Member

jpic commented Feb 17, 2014

Hi, could you paste the full traceback ? Also, could you check if you have a site.py file in your python environment ?

@jpic
Copy link
Member

jpic commented Feb 17, 2014

It works for me here:

>>> print u'\u0101'
ā

Maybe there's a conflicting site.py file in your environment, I've seen that happen a couple of times.

@sajuptpm
Copy link
Author

print u'\u0101'
ā

Why one "-" symbol on top of "a". I don't want that. I don't want to show that to user.
How to remove that. Its irritating.

@jpic
Copy link
Member

jpic commented Feb 17, 2014

Maybe you could fork django-cities-light and remove all unicode support instead of fixing your environment ?

@mauricioabreu
Copy link

Please, provide full traceback. At the moment, I suppose this error is being thrown by database or something like this.

"Why one "-" symbol on top of "a"" Ok, you don't want that, but that is the right way to write that.

If you want the non-accented names, try to use name_ascii property.

c = City.objects.filter(name='Abaeté')[0]
c.name_ascii

@jpic
Copy link
Member

jpic commented Apr 6, 2014

No feedback

@jpic jpic closed this as completed Apr 6, 2014
@mauricioabreu
Copy link

I think my solution would work though.

@jpic
Copy link
Member

jpic commented Apr 6, 2014

Another solution would be to convert to ascii in city_items_pre_import.

@jpic
Copy link
Member

jpic commented Apr 6, 2014

@mauricioabreu
Copy link

Good job!

2014-04-06 11:13 GMT-03:00 James Pic notifications@github.com:

Added faq
http://django-cities-light.readthedocs.org/en/latest/#some-data-fail-to-import-how-to-skip-them

Reply to this email directly or view it on GitHubhttps://github.com//issues/42#issuecomment-39669370
.

Mauricio de Abreu Antunes

Github: https://github.com/mauricioabreu
Twitter: https://twitter.com/maugzoide

@jpic
Copy link
Member

jpic commented Apr 6, 2014

Thanks, and thanks for sharing a bit of your time to provide user support ;)

On Sun, Apr 6, 2014 at 4:31 PM, Mauricio de Abreu Antunes <
notifications@github.com> wrote:

Good job!

2014-04-06 11:13 GMT-03:00 James Pic notifications@github.com:

Added faq

http://django-cities-light.readthedocs.org/en/latest/#some-data-fail-to-import-how-to-skip-them

Reply to this email directly or view it on GitHub<
#42 (comment)

.

Mauricio de Abreu Antunes

Github: https://github.com/mauricioabreu
Twitter: https://twitter.com/maugzoide


Reply to this email directly or view it on GitHubhttps://github.com//issues/42#issuecomment-39669845
.

http://yourlabs.org http://blog.yourlabs.org
Customer is king - Le client est roi - El cliente es rey.

@mauricioabreu
Copy link

No problem! We are here to help.

2014-04-06 14:24 GMT-03:00 James Pic notifications@github.com:

Thanks, and thanks for sharing a bit of your time to provide user support
;)

On Sun, Apr 6, 2014 at 4:31 PM, Mauricio de Abreu Antunes <
notifications@github.com> wrote:

Good job!

2014-04-06 11:13 GMT-03:00 James Pic notifications@github.com:

Added faq

http://django-cities-light.readthedocs.org/en/latest/#some-data-fail-to-import-how-to-skip-them

Reply to this email directly or view it on GitHub<

#42 (comment)

.

Mauricio de Abreu Antunes

Github: https://github.com/mauricioabreu
Twitter: https://twitter.com/maugzoide

Reply to this email directly or view it on GitHub<
https://github.com/yourlabs/django-cities-light/issues/42#issuecomment-39669845>

.

http://yourlabs.org http://blog.yourlabs.org
Customer is king - Le client est roi - El cliente es rey.

Reply to this email directly or view it on GitHubhttps://github.com//issues/42#issuecomment-39674104
.

Mauricio de Abreu Antunes

Github: https://github.com/mauricioabreu
Twitter: https://twitter.com/maugzoide

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

3 participants