<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[pythonscript: saying that encoding is not defined.]]></title><description><![CDATA[<p dir="auto">I have the following line in my python script<br />
#coding=utf8</p>
<p dir="auto">the script runs but there is a message at console that<br />
SyntaxError: Non-ASCII character ‘\xe0’ in file C:\Users\ilLUSIon\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\Repl_nuqta.py on line 4, but no encoding declared; see <a href="http://python.org/dev/peps/pep-0263/" rel="nofollow ugc">http://python.org/dev/peps/pep-0263/</a> for details</p>
<p dir="auto">this script was running well in w8-1, 64 bit on 32 bit npp,</p>
<p dir="auto">recently I switched to w10-64 bit, and installed 64 bit npp,<br />
now it is giving this error.</p>
<p dir="auto">I had</p>
<p dir="auto">Please resolve.<br />
Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/16899/pythonscript-saying-that-encoding-is-not-defined</link><generator>RSS for Node</generator><lastBuildDate>Fri, 12 Jun 2026 19:00:57 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/16899.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Jan 2019 15:36:30 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Sat, 12 Jan 2019 17:19:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/meta-chuh" aria-label="Profile: Meta-Chuh">@<bdi>Meta-Chuh</bdi></a> said:</p>
<blockquote>
<p dir="auto">the ? will lead you to this complete manual on how to markup everything</p>
</blockquote>
<p dir="auto">Yes but quite frankly that sucks.  :D</p>
<blockquote>
<p dir="auto">but you sometimes seem to be too stubborn to read or try to understand what people tell you</p>
</blockquote>
<p dir="auto">This is a very common problem here; reminds me much of the OP in this thread: <a href="https://notepad-plus-plus.org/community/topic/16840/the-strange-behavior-of-the-cursor-in-the-notepad-window" rel="nofollow ugc">https://notepad-plus-plus.org/community/topic/16840/the-strange-behavior-of-the-cursor-in-the-notepad-window</a></p>
]]></description><link>https://community.notepad-plus-plus.org/post/38417</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38417</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 12 Jan 2019 17:19:15 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Sat, 12 Jan 2019 15:56:10 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a></p>
<blockquote>
<p dir="auto">site developer should study other sites how simple their post formatting aids are.</p>
</blockquote>
<p dir="auto">feel free to contact the developers of nodebb <a href="https://nodebb.org" rel="nofollow ugc">here</a> ;-)</p>
<p dir="auto">but the best thing is if you would read the posts you have been given.</p>
<p dir="auto">i quote <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> : … the help can be found by clicking that ? in the COMPOSE window, or by following the link I posted above which gives an excellent summary of how to use markdown in the forum …</p>
<p dir="auto">first the ? will lead you to <a href="https://daringfireball.net/projects/markdown/syntax" rel="nofollow ugc">this complete manual on how to markup everything</a></p>
<p dir="auto">second, he took the extra time to extract and post what is relevant for you with an extra explanation and examples, but you sometimes seem to be too stubborn to read or try to understand what people tell you.</p>
<p dir="auto">please participate, if you want to get your problems solved.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38415</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38415</guid><dc:creator><![CDATA[Meta Chuh]]></dc:creator><pubDate>Sat, 12 Jan 2019 15:56:10 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Sat, 12 Jan 2019 14:12:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a> said:</p>
<blockquote>
<p dir="auto">site developer should study other sites how simple their post formatting aids are</p>
</blockquote>
<p dir="auto">I agree it could be better.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38413</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38413</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Sat, 12 Jan 2019 14:12:22 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Sat, 12 Jan 2019 12:03:50 GMT]]></title><description><![CDATA[<p dir="auto">Alan Kilborn</p>
<p dir="auto">You are right. it troubled all of you and took your time and effort.</p>
<p dir="auto">It had caused problem to me also that while the script was not working, I had to find a way around and I had to create a foxreplace for those sets of character, and put everything every time there to do the conversion.</p>
<p dir="auto">I don’t know why this site is giving so complicated method of posting.<br />
what you said ’ ’ ’ will format quote, is not appearing anywhere in the toolbar that appears at post writing.</p>
<p dir="auto">just four icons appear in toolbar, bold/ italic are understood, 4th could be link, what is 3rd, (like details in windows) is not clear,<br />
I fear to click at those icon because they might delete my post written so far.</p>
<p dir="auto">even mouse hover tool tip is not appearing on them.</p>
<p dir="auto">there is no option for image posting,<br />
there is no option for code-posting.</p>
<p dir="auto">At least they can just give a plain text option of posting, instead of so many categorizations.</p>
<p dir="auto">or if such an option is available somewhere deep in setting, please guide me to that.</p>
<p dir="auto">site developer should study other sites how simple their post formatting aids are.</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38407</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38407</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Sat, 12 Jan 2019 12:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Fri, 11 Jan 2019 16:51:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a> said:</p>
<blockquote>
<p dir="auto">This is my entire script</p>
<p dir="auto">editor.beginUndoAction()<br />
#coding=utf8</p>
</blockquote>
<p dir="auto">The real problem likely could have been found in like 3 seconds if you would have ever learned how to present code via correct markdown on this forum.</p>
<p dir="auto">Scrolling back quickly thru all of the postings shows that only Peter’s code replies use the black-box markdown.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38361</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38361</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 11 Jan 2019 16:51:21 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Fri, 11 Jan 2019 16:31:50 GMT]]></title><description><![CDATA[<p dir="auto">I’m glad you found the problem.<br />
Per <a href="https://www.python.org/dev/peps/pep-0263/" rel="nofollow ugc">PEP 263</a>, “To define a source code encoding, a magic comment must be placed into the source files either as <strong>first</strong> or <strong>second</strong> line” (emphasis added).  That has been true since Python 2.3 in 2001, so it wasn’t a recent change in the Python library.  (Besides, since I started using PythonScript a few years ago, they haven’t changed from Python 2.7).  I am not sure how it ever would have worked on the third line for you.  But the important thing is that you now know it needs to go on the first or second line of your file.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38359</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38359</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 11 Jan 2019 16:31:50 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Fri, 11 Jan 2019 07:19:13 GMT]]></title><description><![CDATA[<p dir="auto">it worked.</p>
<p dir="auto">I had put<br />
editor.beginUndoAction()<br />
#coding:utf8</p>
<p dir="auto">in my file. meaning coding was not on the first line.</p>
<p dir="auto">how I put coding in the first line.</p>
<p dir="auto">#coding:utf8<br />
editor.beginUndoAction()</p>
<p dir="auto">the error stopped and it did the required change in my text file.</p>
<p dir="auto">I can still say that the previous version was working ever since, but stopped working after I switched to 64 bit and new version.</p>
<p dir="auto">maybe, that had change some python version or something that had been causing the error.</p>
<p dir="auto">Thanks a lot for guiding me step by step to solution.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38326</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38326</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Fri, 11 Jan 2019 07:19:13 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Fri, 11 Jan 2019 07:15:49 GMT]]></title><description><![CDATA[<p dir="auto">your last script gave this output on cosole.<br />
SMILE: ☺<br />
क़</p>
<p dir="auto">it is correct. so it seems that encoding is not the problem.</p>
<p dir="auto">thanks for you putting so much time and effort.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38325</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38325</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Fri, 11 Jan 2019 07:15:49 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 16:23:10 GMT]]></title><description><![CDATA[<p dir="auto">I see that you were also trying without the hyphen in <code>utf8</code> and with a colon instead of an equal:</p>
<pre><code># coding:utf8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">that one with <code># coding:utf8</code> (no space before the colon) passed</p>
<pre><code># coding :utf8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">The one with <code># coding :utf8</code> (with the space before the colon) failed.</p>
<p dir="auto">Try again with no space between <code>#</code> and <code>coding</code>, and a space after the colon:</p>
<pre><code>#coding : utf8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">with <code>space colon space</code>, it fails</p>
<pre><code>#coding: utf8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">With <code>nospace colon space</code>, it passes.</p>
<p dir="auto">I cannot get the error with the lines you say you are trying.  Sorry.</p>
<p dir="auto">[these four attempts were still with 7.6.2 64bit portable, as above]</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38238</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38238</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 09 Jan 2019 16:23:10 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 16:15:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a>,</p>
<p dir="auto">I downloaded portable editions of 7.6.1-32, 7.6.1-64, 7.6.2-32, and 7.6.2-64.  I manually installed PythonScript 1.3.0.0 into all four portable installations.</p>
<p dir="auto">I ran the two scripts I just showed in all four instances.  In all four, the version with <code># encoding=utf-8</code> worked, and the version with <code># encoding =utf-8</code> failed.</p>
<p dir="auto">In 7.6.2-64, I then edited the two scripts to use <code>coding</code> instead of <code>encoding</code>:</p>
<pre><code># coding =utf-8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">This version failed with the same error.</p>
<p dir="auto">And the “correct” version:</p>
<pre><code># coding=utf-8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">passed, as it did with <code>encoding</code>.</p>
<p dir="auto">Using the encoding lines that are coming through your forum-markdown badly formatted, I cannot reproduce your problem.  The only ways I can reproduce your error message are to put a space between <code>coding</code> and <code>=</code>, or by not having the encoding line.</p>
<p dir="auto">It is not a problem with PythonScript 1.3.0.0.  It is not a problem with my portable versions of 7.6.2 for either 32bit or 64bit.</p>
<p dir="auto">Either the text you are quoting is getting mangled – in which case, you will have to correctly use markdown to avoid it getting mangled – or you are doing something else wrong, or there is something else unique about your setup that I cannot reproduce in my portable setup.</p>
<p dir="auto">-—<br />
Complete <strong>? &gt; Debug Info</strong> for 7.6.2 64bit</p>
<pre><code>Notepad++ v7.6.2   (64-bit)
Build time : Jan  1 2019 - 00:02:38
Path : C:\usr\local\apps\npp64.7.6.2\notepad++.exe
Admin mode : OFF
Local Conf mode : ON
OS : Windows 10 (64-bit)
Plugins : DSpellCheck.dll mimeTools.dll NppConverter.dll PythonScript.dll
</code></pre>
]]></description><link>https://community.notepad-plus-plus.org/post/38237</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38237</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 09 Jan 2019 16:15:43 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 15:10:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a>,</p>
<p dir="auto">Please, if you want our help, format your posts so that code looks like code, rather than getting interpreted by the forum.  As we’ve already pointed out, the help can be found by clicking that ? in the COMPOSE window, or by following the <a href="https://notepad-plus-plus.org/community/topic/14262/how-to-markdown-code-on-this-forum/2" rel="nofollow ugc">link I posted above</a> which gives an excellent summary of how to use markdown in the forum.</p>
<blockquote>
<p dir="auto">I am using double quotes, not single. like editor.replace(u"क़", u"क़")</p>
</blockquote>
<p dir="auto">python does not distinguish between single and double quotes, unlike some other languages, so that’s irrelvant (as you discovered later).</p>
<blockquote>
<p dir="auto">this script was working ever since in npp 7.6.1 32-bit I guess,<br />
then I switched to npp 7.6.2 64 bit and I noticed that this unicode chars replacements have stopped working.</p>
</blockquote>
<p dir="auto">Ah, this is useful information: you not only changed between 32-bit and 64-bit, you also changed version.  This is likely the culprit.  I will have to find time to download portable editions of those, install pythonscript, and see if I can reproduce your problem.</p>
<p dir="auto">In the mean time, you example script (even if the source wasn’t clobbered by the forum) is way longer than it needs to be in order to debug the problem. The issue at hand is only trying to set the encoding, so we just need a minimal script that shows the issue.</p>
<p dir="auto">In 7.5.8 32-bit, this exact text (copy/paste from the box into a new pythonscript file, then run the python script), will run successfully:</p>
<pre><code># encoding=utf-8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">Where the output is</p>
<pre><code>SMILE: ☺
क़
</code></pre>
<p dir="auto">(That was an even-more-simplified version of the script that I had shown earlier, which removes the namespace-protecting function names – but then I used your double-quoted u-string)</p>
<p dir="auto">And this version of the script (the exact text shown) will give the error</p>
<pre><code># encoding =utf-8
from Npp import console
console.show()
console.clear()
console.write( u'SMILE: ☺\n' )
console.write( u"क़" )
</code></pre>
<p dir="auto">where the error I see is</p>
<pre><code>File "C:\Users\peter.jones\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\NppForumPythonScripts\16899-encoding-sscce.py", line 5
SyntaxError: Non-ASCII character '\xe2' in file C:\Users\peter.jones\AppData\Roaming\Notepad++\plugins\Config\PythonScript\scripts\NppForumPythonScripts\16899-encoding-sscce.py on line 5, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
</code></pre>
<p dir="auto">Please try those two exact scripts in your installation(s) of Notepad++ and describe your results.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38236</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38236</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 09 Jan 2019 15:10:38 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 13:06:44 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a> said:</p>
<blockquote>
<p dir="auto">If script has some problem or error, is there any method to stop script right there, instead of it going ahead and skipping processing of the incorrect part, without the user getting to know?</p>
</blockquote>
<p dir="auto">If there is a Python-level error, scripts stop dead and the reason is reported in the Pythonscript console.  Of course, to see it you have to have the console opened.  It would be nice, and I think it has been requested in the past, if in such a case the console would be opened (if not open) or made-visible to the user (if not the active tab on a multitabbed docked window) when such a thing occurs.</p>
<p dir="auto">BTW, <em>please</em> put your code in proper markdown form.  Those huge lines were really jarring.</p>
<h1>or should I say jarring?</h1>
]]></description><link>https://community.notepad-plus-plus.org/post/38224</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38224</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 09 Jan 2019 13:06:44 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 07:11:47 GMT]]></title><description><![CDATA[<p dir="auto">searching on net, I found <a href="https://stackoverflow.com/questions/18078851/syntaxerror-of-non-ascii-character" rel="nofollow ugc">https://stackoverflow.com/questions/18078851/syntaxerror-of-non-ascii-character</a><br />
so I used</p>
<h1>-<em>- coding: utf-8 -</em>-</h1>
<p dir="auto">but this is also not working.<br />
thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38214</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38214</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Wed, 09 Jan 2019 07:11:47 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 07:05:54 GMT]]></title><description><![CDATA[<p dir="auto">#coding=utf8 is not working</p>
<h1>coding=utf8 is not working</h1>
<p dir="auto">#encoding=utf8 is not working</p>
<h1>encoding=utf8 is not working</h1>
<p dir="auto">you had mentioned (u’☺’ ) with single quote so I tried that also,<br />
but single quote as well as double quotes are not working.</p>
<p dir="auto">thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38213</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38213</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Wed, 09 Jan 2019 07:05:54 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 07:00:15 GMT]]></title><description><![CDATA[<p dir="auto">it doesn’t even give a notice on npp window while running. It only show on console which is not always on. so  I had processed several files wrongly while this was not working, and then I noticed in one file and then checked the message on console to know.</p>
<p dir="auto">If script has some problem or error, is there any method to stop script right there, instead of it going ahead and skipping processing of the incorrect part, without the user getting to know?</p>
<p dir="auto">Thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38212</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38212</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Wed, 09 Jan 2019 07:00:15 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 06:59:12 GMT]]></title><description><![CDATA[<p dir="auto">This is my entire script</p>
<p dir="auto">editor.beginUndoAction()<br />
#coding=utf8</p>
<h1>This replaces separate-nuqta + letter with nuqta-containing letters</h1>
<p dir="auto">editor.replace(u"क़", u"क़")<br />
editor.replace(u"ख़", u"ख़")<br />
editor.replace(u"ग़", u"ग़")<br />
editor.replace(u"ज़", u"ज़")<br />
editor.replace(u"ड़", u"ड़")<br />
editor.replace(u"ढ़", u"ढ़")<br />
editor.replace(u"फ़", u"फ़")</p>
<p dir="auto">#removes ZERO WIDTH SPACE<br />
editor.replace(unichr(8203),“”)<br />
#removes ZERO WIDTH NON JOINER<br />
editor.replace(unichr(8204),“”)<br />
#removes ZERO WIDTH JOINER<br />
editor.replace(unichr(8205),“”)</p>
<p dir="auto">#trim leading trailing space<br />
notepad.menuCommand(42043)<br />
#remove empty lines (containing blank characters)<br />
notepad.menuCommand(42056)<br />
editor.endUndoAction()</p>
<blockquote>
<p dir="auto">you may need to use unicode strings notation (u’☺’ )</p>
</blockquote>
<p dir="auto">I am using double quotes, not single. like editor.replace(u"क़", u"क़")</p>
<p dir="auto">this script was working ever since in npp 7.6.1 32-bit I guess,<br />
then I switched to npp 7.6.2 64 bit and I noticed that this unicode chars replacements have stopped working.</p>
<p dir="auto">thanks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38211</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38211</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Wed, 09 Jan 2019 06:59:12 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Wed, 09 Jan 2019 06:53:46 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto">Which version of Notepad++ are you using?</p>
</blockquote>
<p dir="auto">I am on npp 7.6.2-64 bit on w10-64 bit and w8.1-64 bit (multiboot, I work in both os with the same npp)</p>
<p dir="auto">thnaks.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38210</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38210</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Wed, 09 Jan 2019 06:53:46 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Tue, 08 Jan 2019 18:47:32 GMT]]></title><description><![CDATA[<p dir="auto">Ah, yeah, I hadn’t read down far enough to notice the regular expression.  That was nice of them to include. :-)</p>
<p dir="auto">So, now it just remains for <a class="plugin-mentions-user plugin-mentions-a" href="/user/v-s-rawat" aria-label="Profile: V-S-Rawat">@<bdi>V-S-Rawat</bdi></a> to confirm whether his line actually matches that regex, and/or paste it in the forum without the forum mangling it. :-)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38185</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38185</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 08 Jan 2019 18:47:32 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Tue, 08 Jan 2019 18:38:55 GMT]]></title><description><![CDATA[<p dir="auto">Ah…it needs to match this regex:  <code>^[ \t\f]*#.*?coding[:=][ \t]*([-_.a-zA-Z0-9]+)</code></p>
<p dir="auto">Since <code>encoding</code> and <code>coding</code> both will match that, both are acceptable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38182</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38182</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 08 Jan 2019 18:38:55 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Tue, 08 Jan 2019 18:35:17 GMT]]></title><description><![CDATA[<p dir="auto">Whoops.  PEP 263 said <code>coding</code>, but I had <code>encoding</code>.</p>
<pre><code># coding=utf8
# worked

# coding= utf8
# worked

# coding =utf8
# error

# coding = utf8
# error
</code></pre>
<p dir="auto">But I get the same results for <code>coding</code> or <code>encoding</code>: the space between the g and the = is the critical part.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38181</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38181</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 08 Jan 2019 18:35:17 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Tue, 08 Jan 2019 18:32:50 GMT]]></title><description><![CDATA[<p dir="auto">The thing that strikes me in this thread is that sometimes <code>encoding</code> is used and sometimes <code>coding</code> is used…are these supposed to be interchangeable?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38180</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38180</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Tue, 08 Jan 2019 18:32:50 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Tue, 08 Jan 2019 18:24:17 GMT]]></title><description><![CDATA[<p dir="auto">Which version of Notepad++ are you using?  Not just 32-bit vs 64-bit, but the version number.  my examples below are in v7.5.8 (with 32-bit or 64-bit indicated)</p>
<p dir="auto">Assuming that the unicode character (<code>☺</code> in my example) is inside a string, you may need to use unicode strings notation (<code>u'☺'</code> ) rather than normal string notation (<code>'☺'</code>).</p>
<p dir="auto">PythonScript currently uses Python 2.7.  I don’t know enough about the intracacies of Python 2.7 to know whether <code>#coding=utf8</code> was always sufficient to be able to not use them; <s>my minimal understanding, all unicodish strings in 2.7 (and thus in PythonScript) should use <code>u''</code> for unicode strings.</s>  I <s>don’t</s> didn’t know whether the PythonScript <code>python2.7.dll</code> was enabled with that option or not.</p>
<p dir="auto">Ok, I was wrong.  Some experimenting (though this is 32-bit NPP 7.5.8 with PythonScript 1.3.0.0):</p>
<pre><code>from Npp import *

def forum_post16899_FunctionName():
    console.show()
    console.clear()
    console.write(u'SMILE: ☺\n')

if __name__ == '__main__': forum_post16899_FunctionName()
</code></pre>
<p dir="auto">will give me the error.</p>
<pre><code># encoding=utf-8

from Npp import *

def forum_post16899_FunctionName():
    console.show()
    console.clear()
    console.write(u'SMILE: ☺\n')

if __name__ == '__main__': forum_post16899_FunctionName()
</code></pre>
<p dir="auto">does not give me the error.  So the <code>u'SMILE: ☺\n'</code> notation is not sufficient, and the <code># coding=utf-8</code> does work</p>
<p dir="auto">Let’s see if i can get PythonScript working in my 7.5.8 64-bit portable.  Yes, those two scripts have the same behavior in both 32-bit and 64-bit NPP v7.5.8.</p>
<p dir="auto">Some more experiments, since the  <a href="https://www.python.org/dev/peps/pep-0263/" rel="nofollow ugc">PEP 263</a> doesn’t show any utf-8 examples:</p>
<pre><code class="language-z"># encoding=utf-8
# worked

# encoding=utf8
# no hyphen: worked

#encoding=utf8
# no space before `encoding`: worked

# encoding= utf8
# space after equal, not before: worked

# encoding = utf8
# space before and after equal: gave your error message

# encoding =utf8
# space before equal, but not after equal: gave your error message
</code></pre>
<p dir="auto">So it appears you cannot have a space between the “encoding” and the “equal”</p>
<p dir="auto">Is the <code>#coding=utf8</code> line that you showed an <em>exact</em> quote, or was it modified by the forum?</p>
<p dir="auto">Rendering help below</p>
<p dir="auto">-----</p>
<p dir="auto">You can get it to render exactly in this forum by surrounding it by the ` mark, like <code>`#coding=utf8`</code>, or by putting it on a line by itself, prefixed with four spaces, so</p>
<pre><code class="language-z">    #coding=utf8
</code></pre>
<p dir="auto">becomes</p>
<pre><code>#coding=utf8
</code></pre>
<p dir="auto">of you can use <code>```z</code> on a line before, and <code>```</code> on a line after (with blank lines surrounding) like:</p>
<pre><code> 
```z
#coding=utf8
```
</code></pre>
<p dir="auto">to render like</p>
<pre><code class="language-z">#coding=utf8
</code></pre>
<p dir="auto"><a href="https://notepad-plus-plus.org/community/topic/14262/how-to-markdown-code-on-this-forum/2" rel="nofollow ugc">this help-with-markdown post</a> will give more details on how to mark up for this forum to successfully communicate.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38177</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38177</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 08 Jan 2019 18:24:17 GMT</pubDate></item><item><title><![CDATA[Reply to pythonscript: saying that encoding is not defined. on Tue, 08 Jan 2019 15:45:37 GMT]]></title><description><![CDATA[<p dir="auto">Edit: I had installed python script from within npp plugin manager, so I guess that 1.3.0 version is 64 bit, matching with npp bit.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/38169</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/38169</guid><dc:creator><![CDATA[V S Rawat]]></dc:creator><pubDate>Tue, 08 Jan 2019 15:45:37 GMT</pubDate></item></channel></rss>