Quote/apostrophe macros insert garbage text
FriendOfFred last edited by
I wanted a quick way to type curly quotation marks and apostrophes in Notepad++, so I created macros with Alt and Ctrl keyboard shortcuts that inserted these characters. To create the macros, I used Windows Alt+number pad shortcuts:
‘ Alt+0145 Ctrl+'
’ Alt+0146 Alt+'
“ Alt+0147 Ctrl+Shift+'
” Alt+0148 Alt+Shift+'
Sometimes, in conditions I still haven’t figured out how to reproduce, the macro inserts a string of characters after the desired character:
[U+001]mVYȸ_[U+009][U+001]@HD[U+001]$N. U+001 is “Start of Heading” and U+009 is Tab. Only the second-to-last character in the string varies: it comes out as
$depending on the character I tried to enter. When I enter the characters directly with Alt+numpad instead of using my Notepad++ shortcuts, the problem never occurs.
All files involved were encoded in UTF-8 without BOM, which is also my default Notepad++ encoding.
I also looked up the macro definition in my shortcuts.xml file, and didn’t find a clue there:
<Macro name="Insert apostrophe" Ctrl="no" Alt="yes" Shift="no" Key="222"> <Action type="1" message="2170" wParam="0" lParam="0" sParam="’" /> </Macro>
Clearly I’m doing something wrong, but what?
guy038 last edited by
Hi @FriendOfFred, and All,
I, personally, add your macro, which works correctly, on my configuration ! But I admit that I didn’t do intensive tests to determine when something is going wrong !
I’ve replied to a similar question, in the post, below :
So, here is a regex S/R, which will normalize the normal quotes to their enhanced version !
Regular expressionsearch mode
Click on the
Et voilà !
So, given this initial text, below :
"Test" "Test” “Test" “Test” 'Test' 'Test’ ‘Test' ‘Test’
You should get the following text :
“Test” “Test” “Test” “Test” ‘Test’ ‘Test’ ‘Test’ ‘Test’
So, at any time, when you perform this S/R, you’re sure that, after replacement, you get the two syntaxes
‘Test’, only !
You could, even, record this S/R as a macro, if you prefer to !