David542
David542

Reputation: 110163

Encoding Japanese characters

How would I encode the following:

chapter_mapping = {'chapter': ' チャプター'}

so I can call chapter_mapping['chapter']. Thank you.

Upvotes: 0

Views: 502

Answers (2)

Gringo Suave
Gringo Suave

Reputation: 31880

You'll also need to add a header to your file in python 2:

# -*- coding: utf-8 -*-
chapter_mapping = {'chapter': u'チャプター'}

Upvotes: 2

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798636

Always use unicode literals.

chapter_mapping = {'chapter': u' チャプター'}

Upvotes: 1

Related Questions