title: Is Python 2.7 actually converting my string to UTF-8 or is the definition of isalnum() different across different machines?
body: <p>My sample.txt:</p>
  
  <pre><code>é Roméo et Juliette vécu heureux chaque après
  </code></pre>
  
  <p>My program:</p>
  
  <pre><code>#!/usr/bin/env python2.7
  # -*- coding: utf-8 -*-
  
  with open("test4", "r") as f:
          s = f.read()
          print(s)
          print(isinstance(s, unicode))
          print(s[0].isalnum())
  </code></pre>
  
  <p>My output:</p>
  
  <pre><code>é Roméo et Juliette vécu heureux chaque après
  
  False
  False
  </code></pre>
  
  <p>From <a href="https://stackoverflow.com/questions/4286637/python-isalpha-and-scandics">Python isalpha() and scandics</a> and <a href="https://stackoverflow.com/questions/4987327/how-do-i-check-if-a-string-is-unicode-or-ascii">How do I check if a string is unicode or ascii?</a> lead me to believe that both statements should be true.</p>
  
  <p>My hypotheses:</p>
  
  <ol>
  <li><p>Emacs is using "iso-latin-1" as the file encoding, which is mucking things up</p></li>
  <li><p>isalnum() depends on something other than encoding</p></li>
  <li><p>Line 2 isn't working</p></li>
  </ol>
  
  <p>My biggest worry is #2. I do not really care about the result of isalnum(), I just want the result to be consistent for different machines/people. Worst case, I can just roll my own isalnum(); but I am curious why I am experiencing this behaviour in the first place.</p>
  
  <p>Also, I want to be sure my program understand UTF-8 encoded documents across different machines as well.</p>
  
  <p>Any ideas of what is going on?</p>