I have a resource that is a text file in my project.
When I double click on it (in windows) it opens up notepad.
I’m afraid of notepad and it’s implementation of what text file is…
These days my text seems to be being converted to something other than ascii, like UTF-8 or Unicode… and messes with me.
Is there a way to say i want to use NotePad++ as my ‘external’ text editor?
It seems to be just that, it was ascii and somehow it no longer is. The content is there but the formatting is wrong as an ascii text file with incorrect line feeds and What looked like letter and figure shift characters to ‘implement’ camel case.
NotePad++ seems a little more sane in it’s selection.
It’s just a 7 bit ascii file, with linefeeds.
but Notepad decided otherwise and now Notepad++ says it’s UTF-8 and has Carriage Return and line feeds… And somehow _ gets translated… shazbats.
It’s not a pure ASCII file.
That ZWSP stuff is a specific Unicode character, used to hint where a line break can occur if needed, but without displaying a hyphen or similar. (Zero Width Space)
It has a double byte unicode value of U+200B
7 bit ascii file, with linefeeds…now Notepad++ says it’s UTF-8 and has Carriage Return and line feeds
if you allow an external editor to amend your text, you can’t always force it to work the way you want it to, and on some machines, it won’t be Notepad OR Notepad++
Notepad++ spots that you are using linefeed only, and leaves it alone
Notepad unapologetically uses Windows end-of-lines -Carriage return + Linefeed
If you read the file back in, from a Windows machine, and it could include Windows endoflines where you really want just linefeed, use
.ReplaceLineEndings(EndOfLine.Unix)
and if that ZWSP is intentional, it is a UTF8 file.
This is perhaps slightly midleading. It has a unicode value U+200B, which, when encoded in UTF-8, takes actually three bytes, thus (from the URL I posted before):
Code Point UTF-8 Character Name
---------- ----- --------------
U+200B e2 80 8b ZERO WIDTH SPACE
Amazing how a simple thing like a text file can have become so complicated.
Maybe it’s time to retire file extensions on windows.
.txt isn’t ‘sufficient’. I can’t even begin to vent about small differences like carriage return line feed vs carriage return or just line feed Three ways to do something that no longer has any bearing to a typewriter.
Windows, Mac…
The OK and cancel buttons are reversed
The window menubar icons are on opposite sides. You’ld imagine that was because they just ‘wanted to be different’
But in many ways they copy each other - Macs dropped reliance on resource forks and moved to file extensions, mimicking Windows. Windows hid file extensions, mimicking Macs…
no longer has any bearing to a typewriter.
Used to be relevant to VT terminals too, if I recall.
But back on topic, at least Xojo’s ability to replace line endings means you can take a text file and read it, and turn it into the form you like, with a line of code.
Apple has only partially moved to file extensions, far as I can see. And to teh extent that they did was just market pressure. Shame they gave in to that, though - putting metadata about the file in as part of the filename was always a bad idea. Such metadata belongs in the file system’s directory entry for the file.