Is str/unicode.encode supposed to work? with replace/ignore

BerlinBrown berlin.brown at gmail.com
Tue Jan 15 20:33:36 EST 2008


With this code, ignore/replace still generate an error

			# Encode to simple ascii format.
			field.full_content = field.full_content.encode('ascii', 'replace')

Error:

[0/1] 'ascii' codec can't decode byte 0xe2 in position 14317: ordinal
not in ran
ge(128)

The document in question; is a wikipedia document.  I believe they use
latin-1 unicode or something similar.  I thought replace and ignore
were supposed to replace and ignore?



More information about the Python-list mailing list