treating str as unicode in legacy code?

Ben benjamin.han at gmail.com
Thu Apr 12 15:57:49 EDT 2007


I'm left with some legacy code using plain old str, and I need to make
sure it works with unicode input/output. I have a simple plan to do
this:

- Run the code with "python -U" so all the string literals become
unicode litrals.
- Add this statement

  str = unicode

  to all .py files so the type comparison (e.g., type('123') == str)
would work.


Did I miss anything? Does this sound like a workable plan?

Thanks!




More information about the Python-list mailing list