[GIS] remove whitespace Python code results in odd character – Field Calculator

arcmapattribute-tablefield-calculatorpythonvba

I need to remove whitespace from the end of a string in a field in ArcMap.

I tried first the VBA function RTrim, but whitespace still remained. I thought maybe the whitespaces were tabs, so I tried 'Replace([field], vbTab, ""), but no luck. Then I tried the Python function rstrip, as so:

!FIELDNAME!.rstrip()

..but this resulted in the whitespace being replaced by this character:

Â

There are several of these characters in each of the fields cells trailing the string.
I have looked online for some meaning of this symbol, but I haven't found any. Doe anyone know what this means? I have still not successfully removed the trailing whitespace.

here is a screenshot of the attribute column after I run the Python code given above:
enter image description here

Best Answer

My co-worker came up with this ArcPy script that fixed the problem...it did require making a new field:

arcpy.AddField_management(featureClass, 'MainStreet', 'TEXT')

sCursor = arcpy.SearchCursor(featureClass)
for sRow in sCursor:
    OID = sRow.OBJECTID
    name = sRow.MainSt.encode('ascii', 'ignore')

    query = '"OBJECTID" = ' + str(OID)
    uCursor = arcpy.UpdateCursor(featureClass, query)
    for uRow in uCursor:
        uRow.MainStreet = name
        uCursor.updateRow(uRow)