This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 28th, 2011  |  syntax: None  |  size: 0.88 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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"
clone this paste RAW Paste Data