diff --git a/pubs/commands/note_cmd.py b/pubs/commands/note_cmd.py index 6018876..cb0ddee 100644 --- a/pubs/commands/note_cmd.py +++ b/pubs/commands/note_cmd.py @@ -25,7 +25,7 @@ def command(conf, args): if args.append is None: ui.edit_file(notepath, temporary=False) else: - latestnote = '{TXT}\n'.format(TXT=args.append) + latestnote = '{txt}\n'.format(txt=args.append) write_file(notepath, latestnote, 'a') NoteEvent(citekey).send() rp.close() diff --git a/tests/test_note_append.py b/tests/test_note_append.py index 7f23f8c..e83cbc1 100644 --- a/tests/test_note_append.py +++ b/tests/test_note_append.py @@ -34,6 +34,11 @@ class TestNoteAppend(DataCommandTestCase): self.execute_cmds(cmds) note_lines.append('bbb') self.assertFileContentEqual(fin_notes, self._get_note_content(note_lines)) + # Test adding Chinese characters + cmds = [('pubs note Page99 -a \347\350\346\345')] + self.execute_cmds(cmds) + note_lines.append('\347\350\346\345') + self.assertFileContentEqual(fin_notes, self._get_note_content(note_lines)) # # Test adding Japanese character # cmds = [('pubs note Page99 -a ソ')] # self.execute_cmds(cmds) @@ -43,7 +48,7 @@ class TestNoteAppend(DataCommandTestCase): @staticmethod def _get_note_content(note_lines): """Given a list of note lines, return full note file content""" - return '{LINES}\n'.format(LINES='\n'.join(note_lines)) + return '{lines}\n'.format(lines='\n'.join(note_lines)) if __name__ == '__main__':