"Peter Otten" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Laurent Rahuel wrote: > >> And using the codecs module > > Why would you de/encode at all?
I'd say the otherwise: why not? This is the recommended practice: decode inputs as soon as possible, work on Unicode, encode only when you write the output. In this particular case, it's not necesary and you get the same results, only because these two conditions are met: - the encoding used is utf-8 - we're looking for '//', and no unicode character contains '/' in its representation using that encoding apart from '/' itself Looking for the byte sequence '//' into data encoded with a different encoding (like utf-16 or ucs-2) could give false positives. And looking for other things (like '¡¡') on utf-8 could give false positives too. The same applies if one wants to skip string literals looking for '"' and '\\"'. Anyway for a toy script like this, perhaps it does not make any sense at all - but one should be aware of the potential problems. -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list