<?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[I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character]]></title><description><![CDATA[<p dir="auto"><img src="/assets/uploads/files/1626713653539-odd-conversion-from-notepad.png" alt="odd conversion from Notepad++.png" class=" img-fluid img-markdown" /><br />
This does not happen with notepad?<br />
Can you tell me how to avoid this problem?<br />
Regards<br />
Alfred (Excel1Star)</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/21524/i-use-notepadd-as-a-great-way-to-copy-text-into-excel-vba-however-i-notice-that-the-underscore-character-gets-converted-to-strange-character</link><generator>RSS for Node</generator><lastBuildDate>Tue, 15 Sep 2026 13:43:14 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/21524.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Jul 2021 16:55:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Sat, 02 Apr 2022 21:00:42 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> ,</p>
<p dir="auto">Learning something every day. :)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75673</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75673</guid><dc:creator><![CDATA[Lycan Thrope]]></dc:creator><pubDate>Sat, 02 Apr 2022 21:00:42 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Sat, 02 Apr 2022 11:14:23 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/mere-human" aria-label="Profile: mere-human">@<bdi>mere-human</bdi></a>, <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/alan-kilborn" aria-label="Profile: alan-kilborn">@<bdi>alan-kilborn</bdi></a>, <a class="plugin-mentions-user plugin-mentions-a" href="/user/lycan-thrope" aria-label="Profile: lycan-thrope">@<bdi>lycan-thrope</bdi></a> and <strong>All</strong>,</p>
<p dir="auto">I’m a bit <strong>late</strong> and I should had suspected, like <strong>Peter</strong>, the <strong><code>Autodetect character encoding</code></strong> option !</p>
<p dir="auto">Now, of course, it easy to understand all the <strong>story</strong>…</p>
<hr />
<ul>
<li>
<p dir="auto">Start Notepad++</p>
</li>
<li>
<p dir="auto">Select the option <strong><code>Settings &gt; Preferences... &gt; MISC</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Untick</strong>, if necessary, the <strong><code>Autodetect character encoding</code></strong> option</p>
</li>
<li>
<p dir="auto">Close the <strong><code>Preferences</code></strong> dialog</p>
</li>
<li>
<p dir="auto">Open a <strong>new</strong> tab ( <strong><code>Ctrl + N</code></strong> )</p>
</li>
<li>
<p dir="auto">Whatever your <strong>default</strong> encoding, choose the option <strong><code>Encoding &gt; Convert to ANSI</code></strong></p>
</li>
<li>
<p dir="auto">Then, <strong>insert</strong> the text below :</p>
</li>
</ul>
<pre><code class="language-diff">Attribut VB_Name = "Module 1"
Option Explicit

'char 151
—————————————————————————————————————————

'char 45
-----------------------------------------

'char 95
_________________________________________

</code></pre>
<ul>
<li>Select the menu option <strong><code>View &gt; Show Symbol &gt; Show All Characters</code></strong></li>
</ul>
<p dir="auto">Note that <strong>each</strong> line of symbols contains <strong><code>41</code></strong> characters, followed with <strong>CRLF</strong></p>
<ul>
<li>Save it with the name <strong><code>Test.txt</code></strong></li>
</ul>
<p dir="auto">=&gt; In the <strong>status</strong> bar, you see the <strong>expected</strong> encoding <strong><code>ANSI</code></strong></p>
<ul>
<li>
<p dir="auto">Now, <strong>close</strong> the file <strong><code>Test.txt</code></strong> ( <strong><code>Ctrl + W</code></strong> )</p>
</li>
<li>
<p dir="auto">Select, again, the <strong><code>Settings &gt; Preferences... &gt; MISC</code></strong> option</p>
</li>
<li>
<p dir="auto"><strong>Tick</strong> the <strong><code>Autodetect character encoding</code></strong> option</p>
</li>
<li>
<p dir="auto">Close the <strong><code>Preferences</code></strong> dialog</p>
</li>
<li>
<p dir="auto">Restore <strong>recent</strong> closed file ( <strong><code>Ctrl + Shift + T</code></strong> )</p>
</li>
</ul>
<p dir="auto">=&gt; This time, the line of the <strong><code>41</code></strong> <strong>EM dash</strong> chars is replaced with a line of <strong><code>20</code></strong> <strong>identical</strong> ideograms, followed by a kind of <strong>dot</strong> and the <strong><code>LF</code></strong> char</p>
<p dir="auto">=&gt; In the <strong>status</strong> bar, the encoding have been changed to <strong><code>Shift-JIS</code></strong> !</p>
<p dir="auto">How to explain this result ?</p>
<hr />
<p dir="auto">Well, the <strong><code>Shift-JIS</code></strong> encoding is a Japanese <strong>double byte</strong> character set ( <strong><code>DBCS</code></strong> ). This name is a bit of a <strong>misnomer</strong> as it should be called a <strong>Multi-Byte</strong> character set ! Indeed, like <strong>Chinese</strong> and <strong>Korean</strong> encodings, this encoding maps some characters with <strong><code>1</code></strong> <strong>byte</strong> and some others with <strong><code>2</code></strong> <strong>bytes</strong>.</p>
<p dir="auto">The layout of the <strong><code>Shift-JIS</code></strong> encoding  is :</p>
<pre><code class="language-diff">ONE    byte  :  0x00 - 0x80

FIRST  byte  :  0x81
SECOND byte  :  0x40 - 0xFC

FIRST  byte  :  0x82
SECOND byte  :  0x4F - 0xF1

FIRST  byte  :  0x83
SECOND byte  :  0x40 - 0xD6

FIRST  byte  :  0x84
SECOND byte  :  0x40 - 0xBE

FIRST  byte  :  0x88
SECOND byte  :  0x9F - 0xFC

FIRST  byte  :  0x89 - 0x9F
SECOND byte  :  0x40 - 0xFC

ONE    byte  :  0xA0 - 0xDF

FIRST  byte  :  0xE0 - 0xE9
SECOND byte  :  0x40 - 0xFC

FIRST  byte  :  0xEA
SECOND byte  :  0x40 - 0xA4

ONE    byte  :  0xF0 - 0xFF
</code></pre>
<p dir="auto">and here is the <strong>complete</strong> contents of the <strong><code>Shift-JIS</code></strong> encoding :</p>
<p dir="auto"><a href="https://unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT" rel="nofollow ugc">https://unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/SHIFTJIS.TXT</a></p>
<p dir="auto">Now, as the <strong>hex</strong> value of the <strong><code>151</code></strong> char is <strong><code>0x97</code></strong>, this means that it is a <strong>lead</strong> byte for the <strong><code>Shift-JIS</code></strong> encoding</p>
<p dir="auto">And it happens that, in the part :</p>
<pre><code class="language-diff">0x9795	0x85CD	# &lt;CJK&gt;
0x9796	0x862D	# &lt;CJK&gt;
0x9797	0x89A7	# &lt;CJK&gt;
0x9798	0x5229	# &lt;CJK&gt;
0x9799	0x540F	# &lt;CJK&gt;
0x979A	0x5C65	# &lt;CJK&gt;
0x979B	0x674E	# &lt;CJK&gt;
</code></pre>
<p dir="auto">The <strong><code>0x9797</code></strong> values ( <strong>first</strong> and <strong>second</strong> byte ) corresponds to the <strong>Unicode</strong> char <strong><code>0x89A7</code></strong>. This is, also, in line with the <strong>decimal</strong> value <strong><code>35239</code></strong>, used by <a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a>, in the <strong>ReplaceUnicode()</strong> function :</p>
<pre><code class="language-diff">Function ReplaceUniCode()
Dim Instring As String
Dim CodeNumber As Long
Instring = Application.Caller.Offset(0, -2)
ReplaceUniCode = Replace(Instring, WorksheetFunction.Unichar(35239), “-”)
End Function
</code></pre>
<hr />
<p dir="auto"><img src="/assets/uploads/files/1648875449014-43c07e97-d926-4782-b362-8ff4a8436d55-ideogram.png" alt="43c07e97-d926-4782-b362-8ff4a8436d55-Ideogram.png" class=" img-fluid img-markdown" /></p>
<hr />
<p dir="auto">So, the first <strong><code>40</code></strong> <strong>EM dash</strong> chars are changed into <strong><code>20</code></strong> characters <strong><code>0x89A7</code></strong> ! Then, the <strong>41th</strong> char <strong><code>0x97</code></strong> is again a <strong>leading</strong> byte which is followed by the <strong><code>0x0D</code></strong> char, as a <strong>second</strong> byte. However, the sequence <strong><code>0x97 - 0x0D</code></strong> does <strong>not</strong> correspond to a <strong>valid</strong> char, as the correct <strong>two bytes</strong> range is from <strong><code>0x97 - 0x40</code></strong> to <strong><code>0x97 - 0xFC</code></strong>. Thus, the <strong><code>Shift-JIS</code></strong> uses a <strong>replacement</strong> character.</p>
<p dir="auto">By successive tries, I found out that the final “<strong>dot</strong>” char is the <strong><code>\x{30FB}</code></strong> character ( <strong>KATAKANA MIDDLE DOT</strong> ). And, in the <strong>Unicode</strong> article :</p>
<p dir="auto"><a href="https://www.unicode.org/versions/Unicode14.0.0/ch18.pdf" rel="nofollow ugc">https://www.unicode.org/versions/Unicode14.0.0/ch18.pdf</a></p>
<p dir="auto">it is said, at bottom of page <strong><code>755</code></strong> :</p>
<blockquote>
<p dir="auto"><strong>Punctuation-like</strong> Characters. <strong><code>U+30FB</code></strong> <strong>katakana middle dot</strong> is used to separate words when writing <strong>non-Japanese</strong> phrases.</p>
</blockquote>
<p dir="auto">So I suppose that the <strong><code>\x{30FB}</code></strong> char is used as the <strong>replacement</strong> char of the last <strong>unknown</strong> sequence <strong><code>0x97 - 0x0D</code></strong>, because the <strong><code>Shift-JIS</code></strong> encoding considers this sequence as possible <strong>non-Japanese</strong> text ?</p>
<p dir="auto">Of course, the structure of the line is preserved thanks to the <strong>EOL</strong> char <strong><code>\x0A</code></strong> !</p>
<p dir="auto">Refers also :</p>
<p dir="auto"><a href="https://en.wikipedia.org/wiki/Shift_JIS" rel="nofollow ugc">https://en.wikipedia.org/wiki/Shift_JIS</a></p>
<hr />
<p dir="auto">Note that if you do <strong>not</strong> have the <strong>Autodetection</strong> ticked, the <strong><code>ANSI</code></strong> text above will <strong>also</strong> show these ideograms if you <strong>normally</strong> choose the <strong><code>Shift-JIS</code></strong> encoding !</p>
<ul>
<li>
<p dir="auto"><strong>Close</strong> the file <strong><code>Test.txt</code></strong> ( <strong><code>Ctrl + W</code></strong> )</p>
</li>
<li>
<p dir="auto">Select the option <strong><code>Settings &gt; Preferences... &gt; MISC</code></strong></p>
</li>
<li>
<p dir="auto"><strong>Untick</strong>, if necessary, the <strong><code>Autodetect character encoding</code></strong> option</p>
</li>
<li>
<p dir="auto">Close the <strong><code>Preferences</code></strong> dialog</p>
</li>
<li>
<p dir="auto">Restore <strong>recent</strong> closed file ( <strong><code>Ctrl + Shift + T</code></strong> )</p>
</li>
</ul>
<p dir="auto">=&gt; The line of <strong>EM dash</strong> <strong><code>\x{2014}</code></strong>  is normally displayed</p>
<p dir="auto">=&gt; In the <strong>status</strong> bar, you see the mention <strong><code>ANSI</code></strong></p>
<ul>
<li>Choose the menu option  <strong><code>Encoding &gt; Character sets Japanese &gt; Shift-JIS</code></strong></li>
</ul>
<p dir="auto">=&gt; Again, the <strong>ideograms</strong> are present with <strong><code>\x0A</code></strong> only as line-ending</p>
<p dir="auto">=&gt; In the <strong>status</strong> bar, you see that the <strong>expected</strong> encoding is <strong><code>Shift-JIS</code></strong></p>
<p dir="auto">Best Regards,</p>
<p dir="auto">guy038</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75664</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75664</guid><dc:creator><![CDATA[guy038]]></dc:creator><pubDate>Sat, 02 Apr 2022 11:14:23 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:47:31 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><br />
Thanks<br />
You were spot on about the autodetect character encoding.<br />
That has cleared up my problem.<br />
Now my extracts are a thing of beauty!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75659</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75659</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:47:31 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:44:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> ,</p>
<p dir="auto">Even though you <em>still</em> didn’t show me the status bar – it’s the little information row at the bottom of Notepad++ – I will give you one more gift.  I am doing this because the alternate information was sufficient.  I can now replicate what you see easily:</p>
<p dir="auto"><img src="https://i.imgur.com/ijY8XVe.gif" alt="" class=" img-fluid img-markdown" /></p>
<p dir="auto">And the fix shown is something I said to try two hours ago.</p>
<blockquote>
<p dir="auto">My guess is that you have a different default character set. If your status bar says ANSI (or a different character set than Windows 1252) when it’s showing those non-Western character, you might try Encoding &gt; Character sets &gt; Western European &gt; Windows 1252, which would cause Notepad++ to re-interpret your file as Win-1252, which I think is what Excel uses during export</p>
</blockquote>
<p dir="auto">But since you decided against trying what I suggested, then you didn’t get your solution then.</p>
<blockquote>
<p dir="auto">Ok, the encoding has somehow switched to Japanese?<br />
How would this happen?<br />
There must be some sequence of characters in the extracted VBA code that is triggering the switch to Japanese?</p>
</blockquote>
<p dir="auto">This happens because you’ve told Notepad++ to try to guess the encoding in the Notepad++ options<br />
<img src="/assets/uploads/files/1648837954765-7e718d9d-f87d-4adf-a93e-e6838afc9a36-image.png" alt="7e718d9d-f87d-4adf-a93e-e6838afc9a36-image.png" class=" img-fluid img-markdown" /><br />
Notepad++ does its best.  But some sequences of characters confuse it.  As you can see, I turn that off.</p>
<p dir="auto">If you ever leave it on, if the characters show up and they don’t look like what you expect, always check the encoding (on the Status Bar, also shown in the Encoding menu, and change the encoding to match the encoding of the source file)</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75657</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75657</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:44:59 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:30:04 GMT]]></title><description><![CDATA[<p dir="auto">There must be some sequence of characters in the extracted VBA code that is triggering the switch to  Japanese?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75654</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75654</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:30:04 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:27:18 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> <img src="/assets/uploads/files/1648837566106-encoding-switch-to-japanese.png" alt="Encoding switch to Japanese.png" class=" img-fluid img-markdown" /><br />
Ok, the encoding has somehow switched to Japanese?<br />
How would this happen?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75653</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75653</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:27:18 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:19:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/lycan-thrope" aria-label="Profile: lycan-thrope">@<bdi>lycan-thrope</bdi></a> <img src="/assets/uploads/files/1648837145290-debug-from-notepadpp.png" alt="debug from notepadpp.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75651</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75651</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:19:09 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:17:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> ,</p>
<p dir="auto">Remember when I mentioned the status bar?  Did you notice what you left out of <strong>every single one</strong> of your Notepad++ screenshots: the status bar.  It has the encoding/charset information that was required for us to give you any more information.</p>
<p dir="auto">Your problem is that the encoding isn’t right for the file you are trying to read.  But you are not telling us anything about what encoding Notepad++ thinks it is.  Even if you refuse to do that, you could have tried my experiment of changing the charset</p>
<p dir="auto">Remember when I said “I assume the latter”: I was expecting you to either confirm that assumption, or contradict it.  Your silence on that matter gave no new information.</p>
<p dir="auto">If you want us to help you, you have to answer questions we ask, and try experiments we suggest.  If you refuse, you will not get your problem solved, because we are not mind readers.</p>
<blockquote>
<p dir="auto">How can I send you a simple bas file</p>
</blockquote>
<p dir="auto">This forum doesn’t host arbitrary files as a downloadable file.  And my IT blocks downloads for most file sharing sites, so if you posted it somewhere else, I wouldn’t be able to grab it.</p>
<p dir="auto">But a VBA .bas export should be a plain text file.  Just copy <em>the text</em> from the ms-notepad window, then come into your reply, hit the <code>&lt;/&gt;</code> button, and paste your contents over the highlighted text – this will put it in a black box, like my example above where I pasted the</p>
<pre><code>' ———————
</code></pre>
<p dir="auto">from Notepad++ into the forum.</p>
<p dir="auto">But when when you do that, and I paste those contents into Notepad++, I guarantee it will match what you pasted in the post… because my working theory,<br />
as I’ve said before, is that your problem is that your copy of Notepad++ is not interpreting the bytes correctly.  And until you give us a screenshot that includes the status bar, we cannot give you any more information than that.</p>
<p dir="auto">Please note: if you respond in any way that doesn’t answer all the questions and issues I’ve raised, I will assume you don’t actually want help, and will stop replying.</p>
<p dir="auto">Good luck.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75650</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75650</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:17:45 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:14:05 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> <img src="/assets/uploads/files/1648836836360-the-151-as-seen-in-hex.png" alt="the 151 as seen in HEX.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75647</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75647</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:14:05 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 18:01:37 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> ,<br />
You have yet to post your debug information by copying the information from the <strong>?</strong> in Notepad++, so the folks here can actually see what your NPP version is showing it’s using.  Although anytime I see a Kanji type character my first thought is that you have a codepage set that doesn’t match one or the other applications setting that you are copying from, and pasting to.  Please provide this information so they can better get a sense of what they’re working with.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75646</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75646</guid><dc:creator><![CDATA[Lycan Thrope]]></dc:creator><pubDate>Fri, 01 Apr 2022 18:01:37 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 17:55:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> ![alt text](<img src="/assets/uploads/files/1648835695932-underscores-extracted-opened-in-notepad-pp.png" alt="underscores extracted opened in notepad pp.png" class=" img-fluid img-markdown" /> image url)<img src="/assets/uploads/files/1648835708984-under-scores-extracted-an-opened-in-notepad.png" alt="Under Scores extracted an opened in notepad.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75645</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75645</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 17:55:43 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 17:52:02 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><br />
How can I send you a simple bas file</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75644</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75644</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 17:52:02 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 16:49:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> said in <a href="/post/75634">I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to strange character</a>:</p>
<blockquote>
<p dir="auto">My style for VBA coding is to use a line of '——————— to block off “paragraphs” of code.</p>
</blockquote>
<p dir="auto">Okay, now you’ve given us something to go on.</p>
<p dir="auto">You don’t say whether you copy/paste, or whether you use the Excel VBA’s Right Click &gt; Export feature.  I assume the latter, because copy/paste between the two works right on that character (I just tried).</p>
<p dir="auto">I exported a VBA module that was just</p>
<pre><code>' ———————
</code></pre>
<p dir="auto">… when I opened in Notepad++, Notepad++ decided it was ANSI, as it shows in the next-to-last section of the status bar:<br />
<img src="/assets/uploads/files/1648830958588-6c88f36d-c440-47d5-8e46-7fdec31ce296-image.png" alt="6c88f36d-c440-47d5-8e46-7fdec31ce296-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">On my machine, the default ANSI codepage is 1252 (so standard western charset)</p>
<p dir="auto"><em>If</em> Notepad++ had mis-interpreted it as UTF-8, it would show a bunch of <code>x97</code> in dark boxes, because the char(151) is 0x97, and is not a valid byte on its own in UTF-8.<br />
<img src="/assets/uploads/files/1648831129142-3d7c7718-924d-4728-91ec-b6ed3013d665-image.png" alt="3d7c7718-924d-4728-91ec-b6ed3013d665-image.png" class=" img-fluid img-markdown" /><br />
If that were the case, you could use <strong>Encoding &gt; ANSI</strong> (note: <em>not</em> <strong>Encoding &gt; Convert to ANSI</strong>) to get Notepad++ to re-interpret as ANSI (and for me, 1252).</p>
<p dir="auto">But your original screenshot showed something that looks like a non-Western character… so it doesn’t seem to be interpreting it as UTF-8.  My guess is that you have a different default character set.  If your status bar says ANSI (or a different character set than Windows 1252) when it’s showing those non-Western character, you might try <strong>Encoding &gt; Character sets &gt; Western European &gt;  Windows 1252</strong>, which would cause Notepad++ to re-interpret your file as Win-1252, which I think is what Excel uses during export (at least, it did for me… but again, my PC’s default character set <em>is</em> 1252, so…)</p>
<p dir="auto"><img src="/assets/uploads/files/1648831754664-f4706271-ab9b-4ad1-b83c-47b09512682f-image.png" alt="f4706271-ab9b-4ad1-b83c-47b09512682f-image.png" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.notepad-plus-plus.org/post/75636</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75636</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Fri, 01 Apr 2022 16:49:15 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 16:45:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> said :</p>
<blockquote>
<p dir="auto">I like to use char(151) because it divides the line in the middle.</p>
</blockquote>
<p dir="auto">You say <code>char(151)</code> but to me that implies you are NOT using Unicode, i.e., UTF-8.</p>
<p dir="auto">In some non-Unicode character sets, including whichever one my Notepad++ is using for ANSI files, 151 is a nice long dash character, apparently:</p>
<p dir="auto"><img src="/assets/uploads/files/1648831208497-65975690-498b-4caa-b553-97d29959f519-image.png" alt="65975690-498b-4caa-b553-97d29959f519-image.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">That’s all well and good, but if you try to mix a single-byte 151 value into a bunch of other characters that are UTF-8, you are going to have a mess (and what you’re getting is a hint of that).</p>
<p dir="auto">So probably the root of your problem is that you aren’t <em>consistently</em> using Unicode, even though you think you are, and this is mucking things up for you.</p>
<p dir="auto">Maybe a better choice for you is to use <a href="https://www.compart.com/en/unicode/U+2014" rel="nofollow ugc">U+2014</a> as a long dash?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75635</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75635</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Fri, 01 Apr 2022 16:45:06 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Fri, 01 Apr 2022 16:31:03 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><br />
I am using VBA to extract source code for Excel projects.<br />
My style for VBA coding is to use a line of '——————— to block off “paragraphs” of code.<br />
I like to use char(151) because it divides the line in the middle.<br />
When I open the extracted source code in NotePad++ I see the weird Unicode.<br />
If I open the same source in notepad - no Unicode is displayed?<br />
How can I send you a sample source code file?<br />
Regards<br />
Alfred</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75634</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75634</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Fri, 01 Apr 2022 16:31:03 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Thu, 31 Mar 2022 17:11:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: alfred-vachris">@<bdi>alfred-vachris</bdi></a> ,</p>
<p dir="auto">Unicode works fine in Notepad++, as long as you have font support for the glyphs.</p>
<p dir="auto">Can you give a step-by-step of exactly what you are doing, and where things look like what, with screenshots (or a screentogif.com-or-similar animated gif) that make it obvious what you’re talking about?</p>
<p dir="auto">See also the conversation <a href="https://community.notepad-plus-plus.org/topic/22745/excel-vba-copy-to-np-dword-is-garbled-vice-versa">here</a> where I talk more on a similar-sounding issue, with screenshots.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75622</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75622</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 31 Mar 2022 17:11:35 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Thu, 31 Mar 2022 16:32:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mere-human" aria-label="Profile: mere-human">@<bdi>mere-human</bdi></a><br />
Changing the encoding has no effect.<br />
Alfred</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75621</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75621</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Thu, 31 Mar 2022 16:32:53 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Thu, 31 Mar 2022 16:30:36 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><br />
Sorry to take so long to get back to this topic.<br />
The odd characters are UNICODE<br />
I have a simple function to replace them:<br />
Function ReplaceUniCode()<br />
Dim Instring As String<br />
Dim CodeNumber As Long<br />
Instring = Application.Caller.Offset(0, -2)<br />
ReplaceUniCode = Replace(Instring, WorksheetFunction.Unichar(35239), “-”)<br />
End Function<br />
Regards<br />
Alfred<br />
The UNICODE does not show up in notepad?</p>
]]></description><link>https://community.notepad-plus-plus.org/post/75620</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/75620</guid><dc:creator><![CDATA[Alfred Vachris]]></dc:creator><pubDate>Thu, 31 Mar 2022 16:30:36 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Tue, 20 Jul 2021 08:45:05 GMT]]></title><description><![CDATA[<p dir="auto">Maybe, the issue is with file encoding?<br />
<img src="/assets/uploads/files/1626770675711-91f4fd93-764f-4c12-8edb-c40f67f9cce7-image.png" alt="91f4fd93-764f-4c12-8edb-c40f67f9cce7-image.png" class=" img-fluid img-markdown" /><br />
Maybe, you need to use a different encoding. Just a guess.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68108</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68108</guid><dc:creator><![CDATA[mere-human]]></dc:creator><pubDate>Tue, 20 Jul 2021 08:45:05 GMT</pubDate></item><item><title><![CDATA[Reply to I use Notepadd++ as a great way to copy text into Excel VBA. However I notice that the underscore character gets converted to  strange character on Thu, 31 Mar 2022 17:03:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/alfred-vachris" aria-label="Profile: Alfred-Vachris">@<bdi>Alfred-Vachris</bdi></a> ,</p>
<p dir="auto">It does not happen in Notepad++, either.  Notepad++ will copy whatever text is in the Notepad++ window, and when you paste it into the VBA editor, it will paste that same text into VBA.</p>
<p dir="auto">The underscores above look correct.  You do have comment lines that seem to have a high-codepoint unicode character.  But for Notepad++ to have put those in the copy buffer, those characters(*) must have existed in the Notepad++ editor when you copied them. (*: or bytes that looked different in Notepad++ due to encoding settings, but got interpreted by VBA as those characters)</p>
<p dir="auto">Did you do something strange, like open a <a href="/topic/16178">binary file</a> in Notepad++, which happened to have some of the text rendered as text, but other characters as binary characters – if so, then when you copied those bytes and pasted them into VBA, maybe <em>VBA</em> interpreted those bytes as the funny characters, and it had nothing to do with Notepad++.</p>
<p dir="auto">But that’s as much guessing as I can do for now.  “It works for me” is the only thing I can be sure of.  If you provide us enough information to try to replicate your problem, maybe someone who has access to Excel+VBA will be able to help (depending on what time of day and how busy I am at work, I might be able to try a quick experiment).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/68093</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/68093</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Thu, 31 Mar 2022 17:03:48 GMT</pubDate></item></channel></rss>