title: Why does IronPython str() of a string object raise a UnicodeEncodeError?
body: <p>Our web app utilizes custom made IronPython scripts (the IronPython version is 2.7.3)</p>
  
  <p>An object in the script is converted to string at one point. It is definitely a string. It is provided by our app and its value has come from an outer system.
  The line that raises the exception is:</p>
  
  <pre><code>return str(customField.Value)
  </code></pre>
  
  <p>where <code>customField.Value</code> is the object I have been describing (<code>customField.Value</code> is of type object).</p>
  
  <p>The object is a string as <code>customField</code> is of type text (a type from our app) and I can pull out its value, which looks like a standard English string and has no characters out of ASCII scope.</p>
  
  <p>The exception logged (after processing by our logger) is:</p>
  
  <pre><code>Error on uploading case data: ('unknown', '\x00', 0, 1, '')
  ['Equals', 'GetHashCode', 'GetType', 'InitializeFromClr', 'Item', 'MemberwiseClone',
   'ReferenceEquals', 'ToString', '__class__', '__delattr__', '__dict__', '__doc__',
   '__format__', '__getattribute__', '__getitem__', '__getslice__', '__hash__', '__init__',
   '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setstate__',
   '__sizeof__', '__str__', '__subclasshook__', '__unicode__', 'args', 'clsException',
   'encoding', 'end', 'message', 'object', 'reason', 'start']
  message: --- ---
  args: --- ('unknown', '\x00', 0, 1, '') ---
  CLR Exception: --- System.Text.EncoderFallbackException ---
  Error located in on line 531 in function 
  Error located in on line 410 in function packData...
  </code></pre>
  
  <p>Why is this happening?
  What should I do to resolve this exception, and what is the proper way to modify the script?</p>