# Python 3 and Python scripts plugin

• @Bill-Winder said:

And then it became: What!??? pythonscript can only use 2.7? Why?

@Scott-Sumner said:

I’m sure you can read about all the details of the design decisions on the old Pythonscript Soucreforge forums if you’d like…

Discussion from a few years ago which discusses some of the hurdles switching from v2 to v3: https://sourceforge.net/p/npppythonscript/discussion/1188885/thread/cf066585/

• @dail Wow! Hairy!

I do encounter just that problem in my normal use of npp. I can paste in è or ã and it generally works fine. But when I open or paste in certain texts (like phonetic transcription from espeak), I get o~ where I should get õ. Npp interprets some accent encoding as two characters, not one (works fine here):

la diskysjˈɔ̃ fˈy syspɑ̃dˈy pɑ̃dˈɑ̃ lə ʁˈɔbʁ
mɛ bjɛ̃tˈoˈandʁuː styˈaʁ la ʁəpʁənˈɛ

I have found no way to fix it by shifting the encoding. (Jedit does the same thing…, but notepad does not.)

• @Bill-Winder said:

la diskysjˈɔ̃ fˈy syspɑ̃dˈy pɑ̃dˈɑ̃ lə ʁˈɔbʁ
mɛ bjɛ̃tˈoˈandʁuː styˈaʁ la ʁəpʁənˈɛ

make sure that the font you use is capable of displaying needed symbols

Cheers
Claudia

• @Claudia-Frank Thanks Claudia! – that fixed it, the moment I checked “enable global font”.

Thanks! (It’s been bugging me…for a long time…)

• Here is one of possible ways to get the text from an unsaved file tab in NppExec to allow further processing of the text:

// temporary file name
set local tmpfile = $(SYS.TEMP)\text.txt // current selection sci_sendmsg SCI_GETSELECTIONSTART set local selStart =$(MSG_RESULT)
sci_sendmsg SCI_GETSELECTIONEND
set local selEnd = $(MSG_RESULT) // select all the text and save it sci_sendmsg SCI_SELECTALL sel_saveto "$(tmpfile)"
// restore the selection
sci_sendmsg SCI_SETSELECTIONSTART $(selStart) sci_sendmsg SCI_SETSELECTIONEND$(selEnd)
// now it's time to process the tmpfile...


• Here is more “advanced” version that avoids visible selection change:

// temporary file name
set local tmpfile = $(SYS.TEMP)\text.txt // disable redrawing sci_sendmsg 0x000B 0 // WM_SETREDRAW FALSE // current selection sci_sendmsg SCI_GETSELECTIONSTART set local selStart =$(MSG_RESULT)
sci_sendmsg SCI_GETSELECTIONEND
set local selEnd = $(MSG_RESULT) // select all the text and save it sci_sendmsg SCI_SELECTALL sel_saveto "$(tmpfile)"
// restore the selection
sci_sendmsg SCI_SETSELECTIONSTART $(selStart) sci_sendmsg SCI_SETSELECTIONEND$(selEnd)
// enable redrawing
sci_sendmsg 0x000B 1 // WM_SETREDRAW TRUE
// now it's time to process the tmpfile...


• NppExec v0.6 beta 1 will introduce new command TEXT_SAVETO and TEXT_LOADFROM that will work with the whole current text. Apart from that, these commands will be similar to SEL_SAVETO and SEL_LOADFROM.

• Hello, @bill-winder, and All,

I’m quite late, but I had have to update my list of fonts and to do some tests, in Notepad++, first ;-))

So, Bill, here is below, a list of Unicode fonts which can, correctly, display your text example :

la diskysjˈɔ̃ fˈy syspɑ̃dˈy pɑ̃dˈɑ̃ lə ʁˈɔbʁ
mɛ bjɛ̃tˈoˈandʁuː styˈaʁ la ʁəpʁənˈɛ

• The first table concerns Monospaced fonts, where all characters have the same width

• The second table concerns Proportional fonts, with variable width

Notes :

• The Unicode number of code-points, handled by the font, is located in the Glyphs column

• The different fonts are sorted out by increasing number of their glyphs

• The default regular weight, only, of each font, is listed. The other weights ( Bold, Italic… ) are absent of the tables, below

• The Lucida Sans Unicode is certainly already installed on your configuation ( v5.00 or higher )

• The Segoe UI family font is probably installed, too ( v5.28 or higher )

• For the Ioveska and Ioveska Slab fonts, read very carefully the README.md part, scrolling downwards, because these fonts are highly configurable ! Refer to :

https://github.com/be5invis/Iosevka

• You may also consult this valuable article, Large, multi-script Unicode fonts for Windows computers, at :

http://www.alanwood.net/unicode/fonts.html

•------------------------•------------•--------•-----------------------------------------------------------------------------------•
|  MONOSPACED Font Name  |   Version  | Glyphs |                                Web Site Link                                      |
•------------------------•------------•--------•-----------------------------------------------------------------------------------•
| Linux Libertine Mono   |   v5.17    |  1,021 | http://www.linuxlibertine.org                                                     |
| SourceCodePro          |   v2.030   |  1,585 | https://github.com/adobe-fonts/source-code-pro/releases/tag/2.030R-ro%2F1.050R-it |
|                        |            |        |                                                                                   |
| Iosevka                |   v1.14.0  |  3,654 | https://github.com/be5invis/Iosevka/releases                                      |
| Iosevka Slab           |   v1.14.0  |  3,654 | https://github.com/be5invis/Iosevka/releases                                      |
|                        |            |        |                                                                                   |
| FreeMono               | v0412.2268 |  4,177 | http://ftp.gnu.org/gnu/freefont/freefont-ttf-20120503.zip                         |
•------------------------•------------•--------•-----------------------------------------------------------------------------------•

•------------------------•------------•--------•-----------------------------------------------------------------------------------•
| PROPORTIONAL Font Name |   Version  | Glyphs |                                Web Site Link                                      |
•------------------------•------------•--------•-----------------------------------------------------------------------------------•
| Lucida Sans Unicode    |   v2.00    |  1,776 | https://fr.ffonts.net/Lucida-Sans-Unicode.font.zip                                |
| Lucida Sans Unicode    |   v5.00    |  1,779 | Usually installed in Windows 8 and higher                                         |
|                        |            |        |                                                                                   |
| Linux Biolinum         |   v1.1.8   |  2,403 | http://www.linuxlibertine.org                                                     |
| Linux Libertine        |   v5.3.0   |  2,676 | http://www.linuxlibertine.org                                                     |
|                        |            |        |                                                                                   |
| SegoeUI                |   v5.05    |  2,901 | https://github.com/KingRider/frontcom/tree/master/css/fonts                       |
| SegoeUI                |   v5.28    |  4,516 | Usually installed in Windows 8 and higher                                         |
|                        |            |        |                                                                                   |
| Junicode               |   v0.78    |  3,286 | http://sourceforge.net/projects/junicode                                          |
|                        |            |        |                                                                                   |
|                        |            |        |                                                                                   |
|                        |            |        |                                                                                   |
| FreeSans               | v0412.2268 |  6,272 | http://ftp.gnu.org/gnu/freefont/freefont-ttf-20120503.zip                         |
| FreeSerif              | v0412.2263 | 10,538 | http://ftp.gnu.org/gnu/freefont/freefont-ttf-20120503.zip                         |
|                        |            |        |                                                                                   |
| Quivira                |   v4.1     | 10,486 | http://www.quivira-font.com                                                       |
|                        |            |        |                                                                                   |
| Arial Unicode MS       |   v1.01    | 50,377 | https://www.wfonts.com/font/arial-unicode-ms                                      |
|                        |            |        |                                                                                   |
| Code 2000              |   v1.171   | 63,546 | http://www.fontspace.com/james-kass/code2000                                      |
•------------------------•------------•--------•-----------------------------------------------------------------------------------•


Best Regards,

guy038

• @Vitaliy-Dovgan Thanks! Good work around. There must be somewhere direct access to an unsaved tab, because I can close npp with an unsaved tab and when I reopen, it is there. So the unsaved tab is actually saved somewhere. Curious!

• @Bill-Winder said:

So the unsaved tab is actually saved somewhere.

Yes, saved under a “Backup” folder by default. I just made 5 “new files” and they were created in this folder with the following names:

new 1@2018-02-19_155611
new 2@2018-02-19_155613
new 3@2018-02-19_155613
new 4@2018-02-19_155615
new 5@2018-02-19_155618


• @guy038 Very cool! I just chose fonts at random until things looked right. Useful description, which will serve elsewhere also – same issue in Jedit. (Though I use Jedit less and less - npp has everything I need and is very fast.)

• @Scott-Sumner and they are numbered! Perfect. Which essentially solves my problem.

I hope! There is one further step. I will have to capture the name of the active tab and give it to NPPEXec.

But that should be possible through the sci_sendmessage function (will look into that), since this is possible:

sci_sendmsg SCI_GETSELECTIONSTART
set local selStart = \$(MSG_RESULT)