<?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[Hex-Editor plugin failed to handle files other than UTF8 encoding]]></title><description><![CDATA[<p dir="auto">Notepad++ v9.7 (64-bit)<br />
Hex-Editor plugin v0.9.8</p>
<p dir="auto">I tested the hex editor with 3 files containing same content but different encodings - UTF8, BIG5, &amp; GB2312. However, no matter which encoding the file used, the hex editor always shows the content in UTF8 encoding.</p>
<p dir="auto">File content : 你好嗎？</p>
<h2>correct result</h2>
<p dir="auto">[UTF8] E4 BD A0 E5 A5 BD E5 97 8E EF BC 9F<br />
[BIG5] A7 41 A6 6E B6 DC A1 48<br />
[GB2312] C4 E3 BA C3 86 E1 A3 BF</p>
<h2>hex-editor plugin result</h2>
<p dir="auto">[UTF8] E4 BD A0 E5 A5 BD E5 97 8E EF BC 9F<br />
[BIG5] E4 BD A0 E5 A5 BD E5 97 8E EF BC 9F<br />
[GB2312] E4 BD A0 E5 A5 BD E5 97 8E EF BC 9F</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/20263/hex-editor-plugin-failed-to-handle-files-other-than-utf8-encoding</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 08:39:20 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/20263.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 03 Nov 2020 09:31:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hex-Editor plugin failed to handle files other than UTF8 encoding on Wed, 04 Nov 2020 15:25:58 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alan-kilborn" aria-label="Profile: Alan-Kilborn">@<bdi>Alan-Kilborn</bdi></a> said in <a href="/post/59381">Hex-Editor plugin failed to handle files other than UTF8 encoding</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/59376">Hex-Editor plugin failed to handle files other than UTF8 encoding</a>:</p>
<blockquote>
<p dir="auto">And I believe that the Scintilla editor object stores the text in memory as UTF8</p>
</blockquote>
<p dir="auto">Is this always true, though?</p>
</blockquote>
<p dir="auto">Apparently not.</p>
<p dir="auto">Using a file with your ➤ character (from the other post) in it, I started playing around.  UTF8, UCS2-LE-BOM, UCS2-BE-BOM all show up differently (and with the number of bytes and endianness that I would expect), but if you choose one of the 8-bit character set “encodings”, it always uses the UTF-8 byte sequence for the ➤ character.</p>
<p dir="auto">So, it appears the Hex Editor works as expected for any of the UTF8/UCS2 encodings, but not with the character set.  Given that character sets are treated differently in the code (there aren’t many NPPM_ or SCI_ messages dealing with character sets, compared to more with the Unicode encodings), it appears that character set is mostly used during read-from-disk or write-to-disk, and not during the internal manipulation.</p>
<blockquote>
<p dir="auto">why does Scintilla have/need the SCI_SETCODEPAGE and SCI_GETCODEPAGE functions?</p>
</blockquote>
<p dir="auto">Not sure, really.  No matter what character set or encoding I choose for a given editor tab, <code>editor.getCodePage()</code> always returns 65001.  As far as I can tell, the SCI_GETCODEPAGE only ever returns 65001.  Even when I change the settings so that New documents are in something like OEM 855, which should be codepage 855, it returns 65001.  Even when I go to cmd.exe, <code>chcp 855</code>, then launch a new instance of Notepad++ from that cmd.exe environment, it returns 65001.  Even if I <code>editor.setCodePage(855)</code>, a subsequent <code>editor.getCodePage()</code> returns 65001.</p>
<p dir="auto">Oh, from Scintilla <a href="https://www.scintilla.org/ScintillaDoc.html#SCI_GETCODEPAGE" rel="nofollow ugc">SCI_GETCODEPAGE</a> docs, “Code page can be set to 65001 (UTF-8), 932 (Japanese Shift-JIS), 936 (Simplified Chinese GBK), 949 (Korean Unified Hangul Code), 950 (Traditional Chinese Big5), or 1361 (Korean Johab).”  So it’s there for choosing either UTF-8 or one of the Asian codepages.  The docs also mentioned that 0 is valid (for disabling multibyte support).  When I set 0, then it reads back 0; similarly for the 6 explicit values quoted.<br />
But if I choose a charset like Shift+JIS, it does not change the SCI_GETCODEPAGE readback, so the codepage and charset are separate entities.</p>
<p dir="auto">But back to the higher level:</p>
<p dir="auto">Basically, it appears that if it’s a real Unicode encoding (UTF8, UCS2), HexEditor will use that byte representation.  But if it’s a “character set”, then it shows UTF8 bytes for non-ASCII characters, no matter how it happens to be encoded on disk.  I am still guessing this is based on how Scintilla handles the bytes internally.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59402</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59402</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 04 Nov 2020 15:25:58 GMT</pubDate></item><item><title><![CDATA[Reply to Hex-Editor plugin failed to handle files other than UTF8 encoding on Wed, 04 Nov 2020 01:24:38 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: PeterJones">@<bdi>PeterJones</bdi></a> said in <a href="/post/59376">Hex-Editor plugin failed to handle files other than UTF8 encoding</a>:</p>
<blockquote>
<p dir="auto">And I believe that the Scintilla editor object stores the text in memory as UTF8</p>
</blockquote>
<p dir="auto">Is this always true, though?<br />
If it is, why does Scintilla have/need the SCI_SETCODEPAGE and SCI_GETCODEPAGE functions?<br />
I probably have (many) misunderstandings of encoding issues…</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59381</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59381</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Wed, 04 Nov 2020 01:24:38 GMT</pubDate></item><item><title><![CDATA[Reply to Hex-Editor plugin failed to handle files other than UTF8 encoding on Wed, 04 Nov 2020 11:20:49 GMT]]></title><description><![CDATA[<p dir="auto">Hello, <a class="plugin-mentions-user plugin-mentions-a" href="/user/peterjones" aria-label="Profile: peterjones">@<bdi>peterjones</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/li-eric" aria-label="Profile: li-eric">@<bdi>li-eric</bdi></a> and **All,</p>
<p dir="auto">Very <strong>informative</strong> answer, indeed, <strong>Peter</strong> !</p>
<p dir="auto">This explains the <strong>first</strong> of the <strong>major</strong> problems, found while testing the <strong><code>Summary</code></strong> feature and mentioned at the <strong>very beginning</strong> of this <strong>long</strong> post of mine :</p>
<p dir="auto"><a href="https://community.notepad-plus-plus.org/post/59069">https://community.notepad-plus-plus.org/post/59069</a></p>
<hr />
<p dir="auto">So, we must remember that the <strong><code>Summary</code></strong> feature just looks into the Notepad++ <strong>buffer</strong>, which is <strong><code>UTF-8</code></strong> encoded. Thus, this fact explains the <strong><code>Document length</code></strong> value seen for <strong><code>UCS-2 BE/LE BOM</code></strong> <strong>encoded</strong> files. However, the value of <strong><code>Characters (without line endings)</code></strong> is <strong>totally</strong> wrong for these encodings and seems to be, instead, the number of <strong>bytes</strong> of its corresponding <strong><code>UTF-8[BOM]</code></strong> file !</p>
<p dir="auto">For instance, the Unicode value of the <strong>four</strong> bytes, of <a class="plugin-mentions-user plugin-mentions-a" href="/user/li-eric" aria-label="Profile: li-eric">@<bdi>li-eric</bdi></a> text, are <strong><code>4F60 597D 55CE FF1F </code></strong>. As <strong>all</strong> these codes belong to the range  <strong><code>[\x{0800}-\x{FFFF}</code></strong>, then <strong>each</strong> ideograph is <strong>coded</strong> with <strong><code>3</code></strong> bytes in an <strong><code>UTF-8</code></strong> <strong>encoded</strong> file, as well as the <strong><code>？</code></strong> <strong>fullwidth</strong> question mark. But, when converted in the <strong><code>UCS-2 BE/LE BOM</code></strong> encoding, the <strong><code>View &gt; Summary...</code></strong> option returns <strong><code>12</code></strong> ( so <em>4 chars x 3 bytes</em> ) instead of the value <strong><code>4</code></strong>, as <strong>correctly</strong> reported in the <strong>status bar</strong> after a <strong>Select All</strong> operation</p>
<p dir="auto">Best Regards</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59379</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59379</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Wed, 04 Nov 2020 11:20:49 GMT</pubDate></item><item><title><![CDATA[Reply to Hex-Editor plugin failed to handle files other than UTF8 encoding on Tue, 03 Nov 2020 20:43:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/li-eric" aria-label="Profile: Li-Eric">@<bdi>Li-Eric</bdi></a> ,</p>
<p dir="auto">That does not surprise me.</p>
<p dir="auto">Notepad++ is a text editor, and it will treat text as text characters, <em>not</em> as individual bytes.  Notepad++ only guarantees what the encoding is when it’s on the disk (for read or for write), not what it is in memory, nor what other plugins might do with the bytes from memory.</p>
<p dir="auto">Based on your results, it is apparent that the Hex Editor gets the contents of the file from the Scintilla editor object, <em>not</em> from the bytes on the disk.  And I believe that the Scintilla editor object stores the text in memory as UTF8, so Hex Editor would see the same.</p>
<p dir="auto">In theory, you could put in a feature request with the developer of HexEditor to allow it to use the real disk contents or the Scintilla-edited contents.  However, the official repo (<a href="https://sourceforge.net/projects/npp-plugins/files/Hex%20Editor/" rel="nofollow ugc">https://sourceforge.net/projects/npp-plugins/files/Hex Editor/</a>) hasn’t been updated in years – the author appears to have abandoned the plugin.  <a class="plugin-mentions-user plugin-mentions-a" href="/user/chcg" aria-label="Profile: chcg">@<bdi>chcg</bdi></a> has provided a bugfix version (<a href="https://github.com/chcg/NPP_HexEdit/" rel="nofollow ugc">https://github.com/chcg/NPP_HexEdit/</a>), but he makes it clear that it’s “unofficial”, and I don’t know whether or not he is actively taking feature requests.</p>
<p dir="auto">If you want a true hex editor, which doesn’t hide the encoding, I suggest using a standalone one (possibly like <a href="https://mh-nexus.de/en/hxd/" rel="nofollow ugc">hxd</a>).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/59376</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/59376</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Tue, 03 Nov 2020 20:43:55 GMT</pubDate></item></channel></rss>