Unicode mapping error

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Jnhel74
Posts: 9
Joined: Fri Oct 11, 2024 8:42 am

Unicode mapping error

Post by Jnhel74 »

Hi all,

Setup:
  • Textpad 9.4.0 (64-bit)
  • Windows 11 Pro 25H2
After some OS tweaking I started getting this error when I open files in Textpad:
No mapping for the unicode character exists in the target multi-byte code page
After closing the notification the file opens as an empty file.

The reason I tweaked Windows was I had a problem when I created new text files from Windows Explorer context menu i.e.: Right mouse click -> New -> Text file.

Files were created with an encoding not familiar nor suitable for me. It might have been just starndard ASCII, for example Scandinavian letters åäö were not working.

I followed this AI-generated guide and got it working within Windows:
  1. Save a file with the desired encoding: Open a new, blank Notepad file. Go to File > Save As... and choose your desired encoding (e.g., UTF-8) from the dropdown menu. Save the file as New Text Document.txt.
  2. Rename the template file: Rename the file to something like TXTUTF-8.txt.
  3. Copy the file to the ShellNew folder: Navigate to C:\WINDOWS\SHELLNEW and copy TXTUTF-8.txt into it.
  4. Modify the registry: Open the Registry Editor by typing regedit in the Run dialog box (Windows key + R).
  5. Navigate to the ShellNew key: Go to HKEY_CLASSES_ROOT\.txt\ShellNew.
  6. Create or modify the FileName value: In the right-hand pane, right-click to create a new String Value and name it FileName (if it doesn't exist).
  7. Set the value data: Double-click FileName and enter TXTUTF-8.txt in the Value data field.
  8. Test the new default: Right-click on the desktop, select New, and then Text Document. Open the new file, and check Save As... to confirm that the encoding is set to your preference by default.
In Step 1 I copied an existing file, did not create new one.
In Step 3 Folder C:\Windows\ShellNew did not exist, I created it.

Seems Textpad did not like this. New files, created after tweaking, work fine. Many of my old files do not but cause the error and open up as empty files.

Long story short, 2 questions:
  1. Is there any workaround to get all new files created with UTF-8 encoding?
    By 'all' I mean both those new files saved from Textpad or Notepad and those created from Windows Explorer.
  2. How do I open my old files in Textpad?
Thanks in advance :)
Last edited by AmigoJack on Tue Nov 04, 2025 7:24 am, edited 1 time in total.
Reason: formatting lists as lists and quotes as quotes
User avatar
AmigoJack
Posts: 597
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Re: Unicode mapping error

Post by AmigoJack »

The error would not occur on empty files. Why do you insist on "creating a new file" in the Explorer that should already have content to begin with? Likewise the choosing the encoding when saving a file (in Notepad) is mandatory - if you just copied an existing file then nobody can know which encoding it has - and TextPad tried its best to guess the encoding, but has to give up at some point.

If you open existing (not "new") files in TextPad and get the error message: where do those files come from? They must have been edited neither with TextPad, nor Notepad. Or no attention to their encoding has been spent.

Delete the text file in C:\Windows\ShellNew\ and this time create a really new and empty one from scratch:
  1. Start Notepad (or TextPad).
  2. Save the new empty file and in the dialog window where it says "Encoding" select "UTF-8". Of course: choose C:\Windows\ShellNew\ as path and the desired filename right away.
Now you should have a file that both TextPad (which by default saves texts in UTF-8) and Notepad should recognize correctly (because it carries a BOM that is not visible to you).
User avatar
bbadmin
Site Admin
Posts: 1031
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Re: Unicode mapping error

Post by bbadmin »

Just a minor correction to AmigoJack's post: by default, TextPad creates new files in the default encoding of the installed language version of Windows, and it refers to that as ANSI. To change the default for particular types of files to UTF-8, change it to that in the appropriate document class.

2025-11-04.png
2025-11-04.png (57.14 KiB) Viewed 2869 times
Post Reply