Select to view content in your preferred language

Find and replace unicode characters

992
2
02-18-2021 02:33 AM
Labels (1)
SimonCrutchley
Frequent Contributor

I have a macro, built by a developer, but it fails when processing some of my files because they have unicode characters. Is there a simple way to search through my feature class to find and replace all of these. For some it has come up with a specific reference e.g. 2013, so I've just done a find and replace, but others have come back just with xc2, which is too vague.

I hope that makes sense. As you can see I'm not a programmer.

Thanks

Tags (1)
0 Kudos
2 Replies
DanPatterson
MVP Esteemed Contributor

To get you started see my link here

Solved: replace accented characters with the field calcula... - GeoNet, The Esri Community

and the link within it.

Since you haven't specified what exactly you want to replace and keep

''.join([i if ord(i) < 128 else ' ' for i in text])

this will replace characters with a space

As in this example

s='ABC马克def'

''.join([i if ord(i) < 128 else ' ' for i in s])
'ABC  def'

from this link python - Replace non-ASCII characters with a single space - Stack Overflow


... sort of retired...
gunturhakim
New Contributor

Hi dan,

oke I will try to follow of that from that link

mampangbest regards

0 Kudos