You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Console Scintilla now set to UTF8, and UTF8 text used, stored and
set in the input editbox. Printing unicode text to the console
still doesn't work properly, so it's not perfect, but it's much
better.
Included some instructions in the docs about working with unicode text.
Upped version to 0.9
Copy file name to clipboardExpand all lines: docs/source/intro.rst
+37-1Lines changed: 37 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,40 @@ If you create a new module (i.e. a new file), and want to use the functions defi
62
62
As the startup script runs in the same namespace as the scripts (__main__), you don't need to import the Npp module in the scripts.
63
63
64
64
65
+
Working with Unicode Text
66
+
=========================
67
+
68
+
Python 2.x works with multi-byte strings, as does Scintilla. That means in most cases, you don't need to do anything special to deal with unicode data,
69
+
as both sides are talking the same language. However, there are a few things to observe, and occassionaly you'll need to do something special to achieve
70
+
what you want to do. One important point is to make sure your script is saved in the same encoding as your target file(s) - this helps unicode strings
71
+
be interpreted the same way.
72
+
73
+
If you need to work with the string (for instance chance the case), you need to convert the string to a Python Unicode string. To convert the string
74
+
append ``.decode('utf8')`` to the string. Obviously if your string is in a different format, use the name of the correct encoding.
75
+
76
+
To put text back to Scintilla (so editor.something()), use .encode('utf8') from a unicode string.
77
+
78
+
For example::
79
+
80
+
# define a unicode variable
81
+
someUnicodeString = u'This häs fünny ünicode chäractêrs in it'
82
+
83
+
# append the text to the current buffer - assuming the current buffer is set to utf8
0 commit comments