criloz / prettytable

Automatically exported from code.google.com/p/prettytable
Other
0 stars 0 forks source link

Chinese Display unnormal #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.open the test script.
2.add "Chinese" colum in head
3.add more cloum "阿斯达" to each row. run the test script.

What is the expected output? What do you see instead?
+--------+------------+----------+---------+
| Kanji  |  Hiragana  | English  | Chinese |
+--------+------------+----------+---------+
|  神戸  |   こうべ   |   Kobe   |  阿斯达 |
|  京都  |  きょうと  |  Kyoto   |  阿斯达 |
|  長崎  |  ながさき  | Nagasaki |  阿斯达 |
| 名古屋 |   なごや   |  Nagoya  |  阿斯达 |
|  大阪  |  おおさか  |  Osaka   |  阿斯达 |
|  札幌  |  さっぽろ  | Sapporo  |  阿斯达 |
|  東京  | とうきょう |  Tokyo   |  阿斯达 |
|  横浜  |  よこはま  | Yokohama |  阿斯达 |
+--------+------------+----------+---------+

Instead:
+--------+------------+----------+---------+
| Kanji  |  Hiragana  | English  | Chinese |
+--------+------------+----------+---------+
|  神戸  |   こうべ   |   Kobe   |  阿斯达 |
|  京都  |  きょうと  |  Kyoto   |  阿斯达 |
|  長崎  |  ながさき  | Nagasaki |  阿斯达 |
| 名古屋 |   なごや   |  Nagoya  |  阿斯达 |
|  大阪  |  おおさか  |  Osaka   |  阿斯达 |
|  札幌  |  さっぽろ  | Sapporo  |  阿斯达 |
|  東京  | とうきょう |  Tokyo   |  阿斯达 |
|  横浜  |  よこはま  | Yokohama |  阿斯达 |
+--------+------------+----------+---------+| とうきょう |  Tokyo   |  
阿斯达 |
|  横浜  |  よこはま  | Yokohama |  阿斯达 |
+--------+------------+----------+---------+------------+----------+---------+

code(changed):
class PrintJapanestTest(unittest.TestCase):

    def setUp(self):

        self.x = PrettyTable(["Kanji", "Hiragana", "English", "Chinese"])
        self.x.add_row(["神戸", "こうべ", "Kobe", "阿斯达"])
        self.x.add_row(["京都", "きょうと", "Kyoto", "阿斯达"])
        self.x.add_row(["長崎", "ながさき", "Nagasaki", "阿斯达"])
        self.x.add_row(["名古屋", "なごや", "Nagoya", "阿斯达"])
        self.x.add_row(["大阪", "おおさか", "Osaka", "阿斯达"])
        self.x.add_row(["札幌", "さっぽろ", "Sapporo", "阿斯达"])
        self.x.add_row(["東京", "とうきょう", "Tokyo", "阿斯达"])
        self.x.add_row(["横浜", "よこはま", "Yokohama", "阿斯达"])

    def testPrint(self):
        print()
        print(self.x)

What version of the product are you using? On what operating system?
v0.7.2 Win7 x86

Please provide any additional information below.
modify the main script ,the main method to test, also has problom.
shows:
+--------------------+-------+------------+-----------------+
| City name          |  Area | Population | Annual Rainfall |
+--------------------+-------+------------+-----------------+
| Sydney             | 2058d |  4336374   |     1214.8f     |
| Perth              | 5386d |  1554769   |      869.4f     |
| Melbourne          | 1566d |  3806092   |      646.9f     |
| Hobart             | 1357d |   205556   |      619.5f     |
| Darwin啊大声大声道 | 0112d |   120900   |     1714.7f     |
| Brisbane           | 5905d |  1857594   |     1146.4f     |
| Adel我啊是         | 1295d |  1158259   |      600.5f     |
+--------------------+-------+------------+-----------------+-----------------+

extra one cloum in last row.

Original issue reported on code.google.com by yangweij...@gmail.com on 21 Nov 2013 at 8:43

GoogleCodeExporter commented 9 years ago
Thank you for reporting this problem.  I will investigate this to see if I can 
fix it.  It's important to me that PrettyTable works correctly for as many 
different languages as possible, so I will take this issue seriously.

Original comment by luke@maurits.id.au on 24 Nov 2013 at 7:23