[TxMt] Python unicode error (was: r8839 (Python)) [reposting]

Hans-Jörg Bibiko bibiko at eva.mpg.de
Sun Jun 1 22:24:31 UTC 2008


Hi,

sorry for breaking the rules! I lost the thread.

>> On 6 Feb 2008, at 22:26, Alexander John Ross wrote:
>>
>>> • Add Unicode support to PyMate / ScriptMate.
>>>
>>> Changed:
>>> U   trunk/Bundles/Python.tmbundle/Support/PyMate/pymate.rb
>>> U   trunk/Bundles/Python.tmbundle/Support/PyMate/tmhooks.py
>>> U   trunk/Support/lib/scriptmate.rb
>>
>>
>> I got this ticket http://macromates.com/ticket/show? 
>> ticket_id=502C2FDD
>> and after some experiments I think the problem is that PyMate does  
>> not
>> pick up on the encoding provided by the user.
>>
>> For example a script like this will error:
>>
>>      # coding: utf-8
>>      print("æble")



I do not know whether this helps to solve the problem, but I just  
figured out that 'print' is the problem. If I'm using  
'sys.__stdout__.write' instead it works.

#!/usr/bin/env python
# encoding: utf-8

import sys
import os

a = u"æble"
sys.__stdout__.write( a.encode("raw_unicode_escape") )

Cheers,

--Hans


More information about the textmate mailing list