Ignore:
Timestamp:
05/06/06 18:09:50 (9 years ago)
Author:
xi
Message:

Fix #11 (Thanks to edemaine(at)mit.edu).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/lib/yaml/emitter.py

    r143 r153  
    698698                line_breaks = True 
    699699            if not (ch == u'\n' or u'\x20' <= ch <= u'\x7E'): 
    700                 if ch < u'\x80' or ch == u'\uFEFF': # '\uFEFF' is BOM. 
    701                     special_characters = True 
    702                 else: 
     700                if (ch == u'\x85' or u'\xA0' <= ch <= u'\uD7FF' 
     701                        or u'\uE000' <= ch <= u'\uFFFD') and ch != u'\uFEFF': 
    703702                    unicode_characters = True 
    704703                    if not self.allow_unicode: 
    705704                        special_characters = True 
     705                else: 
     706                    special_characters = True 
    706707 
    707708            # Spaces, line breaks, and how they are mixed. State machine. 
     
    962963            if ch is None or ch in u'"\\\x85\u2028\u2029\uFEFF' \ 
    963964                    or not (u'\x20' <= ch <= u'\x7E' 
    964                             or (self.allow_unicode and ch > u'\x7F')): 
     965                        or (self.allow_unicode 
     966                            and (u'\xA0' <= ch <= u'\uD7FF' 
     967                                or u'\uE000' <= ch <= u'\uFFFD'))): 
    965968                if start < end: 
    966969                    data = text[start:end] 
Note: See TracChangeset for help on using the changeset viewer.