Should I use Unicode string by default?

前端 未结 6 829
星月不相逢
星月不相逢 2021-02-07 03:38

Is it considered as a good practice to pick Unicode string over regular string when coding in Python? I mainly work on the Windows platform, where most of the string types are U

6条回答
  •  花落未央
    2021-02-07 04:13

    From my practice -- use unicode.

    At beginning of one project we used usuall strings, however our project was growing, we were implementing new features and using new third-party libraries. In that mess with non-unicode/unicode string some functions started failing. We started spending time localizing this problems and fixing them. However, some third-party modules doesn't supported unicode and started failing after we switched to it (but this is rather exclusion than a rule).

    Also I have some experience when we needed to rewrite some third party modules(e.g. SendKeys) cause they were not supporting unicode. If it was done in unicode from beginning it will be better :)

    So I think today we should use unicode.

    P.S. All that mess upwards is only my hamble opinion :)

提交回复
热议问题