Hi,

Dag Sverre Seljebotn wrote:
> # coding: utf-8
> # declare libc printf...
> def usage():
>   printf("Usage: Å\n")
> 
> Keep in mind that there are three environments: The system of the Cython 
> developer (developer's local workstation), the system for compilation 
> (might be a big build-farm on a system with a different encoding), and 
> the runtime system (end-user workstation, might have a third encoding).
> 
> - What will happen now: The character will be output on screen using the 
> encoding of the developer who wrote the Cython program, no matter what 
> the encoding is on the compilation system or runtime system.
> - What should happen: Whatever is an "Ø" should be output on the ta

No. We are talking about byte strings here, not unicode strings. I don't want
this to print anything but what the user's locale gives you.

If, on the other hand, you write

  def usage():
    printf(u"Usage: Å\n")

under Py2, or

  def usage():
    printf("Usage: Å\n")

under Py3 semantics, you should get a compiler error that you can't convert a
unicode string to a char*.

Stefan

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to