Advertisement
Guest User

Untitled

a guest
Apr 28th, 2011
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. Output on TTY with
  2. - ENCODING set
  3. - binmode set
  4.  
  5. (TT expects utf8 for input and produces uft8 output)
  6.  
  7. $ perl tt.pl
  8. Var = abcdef
  9.  
  10. 6 # prints 6
  11. fööbä # prints "fööbä"
  12. fööb # prints "fööb"
  13.  
  14. ==================================
  15. Output with
  16. - ENCODING set
  17. - binmode NOT set
  18.  
  19. (TT reads UTF8 properly, calculates correctly, but produces iso-8859-1 for output)
  20.  
  21. $ perl tt.pl
  22. Var = abcdef
  23.  
  24. 6 # prints 6
  25. f??b? # prints "f??b?"
  26. f??b # prints "f??b"
  27.  
  28. ==================================
  29. Output with
  30. - ENCODING NOT set
  31. - binmode NOT set
  32.  
  33. (TT expects iso-8859-1, gets UTF8 and uses it without conversation, calculations are incorrect due to false expectations of TT, TT outputs as ISO-8859-1 without conversation thus printing the UTF8 chars correctly "by accident")
  34.  
  35. $ perl tt.pl
  36. Var = abcdef
  37.  
  38. 9 # prints 6
  39. föö # prints "fööbä"
  40. fö? # prints "fööb"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement