#3058: Bug of the wiki compiler
-----------------------------------+----------------------------------------
 Reporter:  [EMAIL PROTECTED]  |        Owner:  cboos
     Type:  defect                 |       Status:  new  
 Priority:  highest                |    Milestone:  0.9.6
Component:  general                |      Version:  0.9.5
 Severity:  normal                 |   Resolution:       
 Keywords:  unicode                |  
-----------------------------------+----------------------------------------
Comment (by cboos):

 ... and in cp1252, we have: {{{A0 = U+00A0 : NO-BREAK SPACE}}}

 Yet another example of why using `unicode` internally is so important
 ([milestone:0.10]).

 In the meantime, for this issue, a temporary conversion to `unicode`
 could do the trick:
 {{{
 Index: trac/wiki/formatter.py
 ===================================================================
 --- trac/wiki/formatter.py      (revision 3213)
 +++ trac/wiki/formatter.py      (working copy)
 @@ -21,6 +21,7 @@
  import re
  import os
  import urllib
 +import StringIO as pyStringIO

  try:
      from cStringIO import StringIO
 @@ -660,7 +661,9 @@
          # Simplify code blocks
          in_code_block = 0
          processor = None
 -        buf = StringIO()
 +        buf = pyStringIO.StringIO()
 +        text = unicode(text, 'utf-8', 'replace')
 +
          for line in text.strip().splitlines():
              if line.strip() == '{{{':
                  in_code_block += 1
 @@ -678,6 +681,7 @@
              else:
                  print>>buf, line
          result = buf.getvalue()[:-1]
 +        result = result.encode('utf-8')

          if shorten:
              result = util.shorten_line(result)
 }}}

 Opinions?

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/3058>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to