summaryrefslogtreecommitdiff
path: root/demoapp/cliffdemo/encoding.py
blob: 6c6c7513c209dc8e79019ca8d32e98a135d714ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- encoding: utf-8 -*-

import logging

from cliff.lister import Lister


class Encoding(Lister):
    """Show some unicode text
    """

    log = logging.getLogger(__name__)

    def take_action(self, parsed_args):
        messages = [
            u'pi: π',
            u'GB18030:鼀丅㐀ٸཌྷᠧꌢ€',
        ]
        return (
            ('UTF-8', 'Unicode'),
            [(repr(t.encode('utf-8')), t)
             for t in messages],
        )