2 new revisions:

Revision: a775aba252e7
Author:   Janne Härkönen <[email protected]>
Date:     Tue Jan 17 05:07:13 2012
Log:      writer: encode all output with UTF-8
http://code.google.com/p/robotframework/source/detail?r=a775aba252e7

Revision: 5624063a4bc2
Author:   Janne Härkönen <[email protected]>
Date:     Tue Jan 17 05:08:05 2012
Log:      tidy: added some unicode in test material
http://code.google.com/p/robotframework/source/detail?r=5624063a4bc2

==============================================================================
Revision: a775aba252e7
Author:   Janne Härkönen <[email protected]>
Date:     Tue Jan 17 05:07:13 2012
Log:      writer: encode all output with UTF-8
http://code.google.com/p/robotframework/source/detail?r=a775aba252e7

Modified:
 /src/robot/writer/serializer.py
 /src/robot/writer/writer.py

=======================================
--- /src/robot/writer/serializer.py     Mon Jan  2 04:28:19 2012
+++ /src/robot/writer/serializer.py     Tue Jan 17 05:07:13 2012
@@ -71,7 +71,7 @@
     @property
     def output(self):
         if not self._output:
-            self._output = codecs.open(self._get_source(), 'wb', 'UTF-8')
+            self._output = open(self._get_source(), 'wb')
         return self._output

     @property
=======================================
--- /src/robot/writer/writer.py Wed Dec 14 05:53:37 2011
+++ /src/robot/writer/writer.py Tue Jan 17 05:07:13 2012
@@ -77,13 +77,17 @@
         for row in rows:
             self._write_row(row)

+    def _encode(self, row):
+        return row.encode('UTF-8')
+

 class SpaceSeparatedTxtWriter(_DataFileWriter):
     _separator = ' '*4
     _formatter = TxtFormatter()

     def _write_row(self, row):
- self._output.write(self._separator.join(row) + self._line_separator)
+        line = self._separator.join(row) + self._line_separator
+        self._output.write(self._encode(line))


 class PipeSeparatedTxtWriter(_DataFileWriter):
@@ -94,7 +98,7 @@
         row = self._separator.join(row)
         if row:
             row = '| ' + row + ' |'
-        self._output.write(row + self._line_separator)
+        self._output.write(self._encode(row + self._line_separator))


 class TsvFileWriter(_DataFileWriter):
@@ -109,7 +113,10 @@
                                   lineterminator=context.line_separator)

     def _write_row(self, row):
-        self._writer.writerow(row)
+        self._writer.writerow(self._encode(row))
+
+    def _encode(self, row):
+        return [c.encode('UTF-8') for c in row]


 class HtmlFileWriter(_DataFileWriter):
@@ -118,7 +125,8 @@
     def __init__(self, context):
         _DataFileWriter.__init__(self, context)
         self._name = context.datafile.name
- self._writer = utils.HtmlWriter(context.output, context.line_separator) + self._writer = utils.HtmlWriter(context.output, context.line_separator,
+                                        encoding='UTF-8')

     def write(self, datafile):
         self._writer.content(TEMPLATE_START % {'NAME': self._name},

==============================================================================
Revision: 5624063a4bc2
Author:   Janne Härkönen <[email protected]>
Date:     Tue Jan 17 05:08:05 2012
Log:      tidy: added some unicode in test material
http://code.google.com/p/robotframework/source/detail?r=5624063a4bc2

Modified:
 /atest/robot/tidy/TidyLib.py
 /atest/testdata/tidy/__init__.txt
 /atest/testdata/tidy/golden.html
 /atest/testdata/tidy/golden.tsv
 /atest/testdata/tidy/golden.txt
 /atest/testdata/tidy/golden_pipes.txt

=======================================
--- /atest/robot/tidy/TidyLib.py        Tue Jan 17 00:49:38 2012
+++ /atest/robot/tidy/TidyLib.py        Tue Jan 17 05:08:05 2012
@@ -43,6 +43,8 @@
         return path.replace('/', os.sep)

     def _assert_result(self, result, expected):
+        result = result.decode('UTF-8')
+        expected = expected.decode('UTF-8')
         for line1, line2 in zip(result.split(), expected.split()):
             msg = "\n%s\n!=\n%s\n" % (result, expected)
             assert_equals(repr(unicode(line1)), repr(unicode(line2)), msg)
=======================================
--- /atest/testdata/tidy/__init__.txt   Fri Jan 13 04:28:56 2012
+++ /atest/testdata/tidy/__init__.txt   Tue Jan 17 05:08:05 2012
@@ -4,3 +4,7 @@
 *** Variables ***
 MyVar             val1    val2    val3    val4    val5    val6    val6
 ...               val7    val8    val9    # var comment
+
+*** Keywords ***
+unicode äö§ name
+    No Operation
=======================================
--- /atest/testdata/tidy/golden.html    Fri Jan 13 04:28:56 2012
+++ /atest/testdata/tidy/golden.html    Tue Jan 17 05:08:05 2012
@@ -182,8 +182,8 @@
     </tr>
     <tr>
         <td class="name"><a name="test_Another Test">Another Test</a></td>
-        <td>No Operation</td>
-        <td></td>
+        <td>Log</td>
+        <td>ääöö§§</td>
         <td></td>
         <td></td>
     </tr>
=======================================
--- /atest/testdata/tidy/golden.tsv     Fri Jan 13 04:28:56 2012
+++ /atest/testdata/tidy/golden.tsv     Tue Jan 17 05:08:05 2012
@@ -16,7 +16,8 @@
        [Teardown]      1 minute        args

 Another Test
-       No Operation
+       Log     ääöö§§
+
 *Keywords*
 My Keyword
        [Documentation] Documentation   # Comment for doc
=======================================
--- /atest/testdata/tidy/golden.txt     Fri Jan 13 04:28:56 2012
+++ /atest/testdata/tidy/golden.txt     Tue Jan 17 05:08:05 2012
@@ -16,7 +16,7 @@
     [Teardown]    1 minute    args

 Another Test
-    No Operation
+    Log    ääöö§§

 *** Keywords ***
 My Keyword
=======================================
--- /atest/testdata/tidy/golden_pipes.txt       Mon Jan 16 04:01:53 2012
+++ /atest/testdata/tidy/golden_pipes.txt       Tue Jan 17 05:08:05 2012
@@ -16,7 +16,7 @@
 |    | [Teardown] | 1 minute | args |

 | Another Test |
-|    | No Operation |
+|    | Log | ääöö§§ |

 | *** Keywords *** |
 | My Keyword |

Reply via email to