Why am I getting file name can't be used error?
Is there any reason I cant name a file this:
The Lonely House on Adachi Moor in Northern Japan Yoshitoshi 1885.png
There are no punctuation marks.
iMac 27″ 5K, macOS 10.14
Is there any reason I cant name a file this:
The Lonely House on Adachi Moor in Northern Japan Yoshitoshi 1885.png
There are no punctuation marks.
iMac 27″ 5K, macOS 10.14
I wonder if 10 spaces is too many, "The Lonely House on AdachiMoor inNorthernJapanYoshitoshi 1885.png" worked.
6 spaces
"The Lonely House on Adachi Moor in Northern Japan Yoshitoshi 1885.png" did not here either.
10 spaces
"The Lonely House on Adachi_Moor_in_Northern_Japan_Yoshitoshi_1885.png" worked.
Nope, nit to many spaces...
Aha, in a Hex editor it looks like 2 of your spaces are actually Linefeeds!
"The Lonely House on Adachi
Moor in Northern Japan
Yoshitoshi 1885.png"
22 54 68 65 20 4C 6F 6E 65 6C 79 20 48 6F 75 73 65 20 6F 6E 20 41 64 61 63 68 69 0A 4D 6F 6F 72 20 69 6E 20 4E 6F 72 74 68 65 72 6E 20 4A 61 70 61 6E 0A 59 6F 73 68 69 74 6F 73 68 69 20 31 38 38 35 2E 70 6E 67 22
I wonder if 10 spaces is too many, "The Lonely House on AdachiMoor inNorthernJapanYoshitoshi 1885.png" worked.
6 spaces
"The Lonely House on Adachi Moor in Northern Japan Yoshitoshi 1885.png" did not here either.
10 spaces
"The Lonely House on Adachi_Moor_in_Northern_Japan_Yoshitoshi_1885.png" worked.
Nope, nit to many spaces...
Aha, in a Hex editor it looks like 2 of your spaces are actually Linefeeds!
"The Lonely House on Adachi
Moor in Northern Japan
Yoshitoshi 1885.png"
22 54 68 65 20 4C 6F 6E 65 6C 79 20 48 6F 75 73 65 20 6F 6E 20 41 64 61 63 68 69 0A 4D 6F 6F 72 20 69 6E 20 4E 6F 72 74 68 65 72 6E 20 4A 61 70 61 6E 0A 59 6F 73 68 69 74 6F 73 68 69 20 31 38 38 35 2E 70 6E 67 22
onefiftymph wrote:
Ok interesting thanks. Don't think I have a hex editor. Maybe I could try dropping it into TextEdit and converting to plain text.
That particular text string is ASCII, with ASCII control characters / control codes. No UTF-8 or other encoding. (Yeah, technically, ASCII is a proper subset of UTF-8.) That text string would be entirely renderable on a computer from the 1970s. And it would still have derailed apps back then that weren’t expecting embedded controls, too.
The question then becomes where the formatting—the control characters—came from, and how to remove that. I’d suspect cut-and-paste from somewhere. What’s the input source here?
Depending on the context, pasting with Command-Shift-V might clear the control characters, or a trip through the command-line tools such as tr or sed or ilk, or otherwise. Perl and Python can also easily do this filtering, but then you have to install and update those.
The full old-school approach is the ansi2txt tool or similar, which also removes ANSI control sequences..
Or removing the control codes in the input. (Which is why I’d asked about that, above.)
There’s probably either a droplet around or one could be created to get (only) the desired stuff into the pasteboard, either in some tool or in zsh or bash using pbcopy and pbpaste. There are related scripts around, too.
When AppleScript wraps long text in a display alert, it uses line feeds for that purpose. I could duplicate those linefeeds here with an AppleScript display alert and by typing the same text as displayed on the OP dialog, or the first paragraph of Steve Job's Stanford address. A screenshot later and selecting the text, copying it to the clipboard and a little Terminal action proves it:
pbpaste | hexdump -C
Eliminate the 2 Linefeeds, make them spaces & it will work my friend! :)
One after Adachi, the other after Japan.
onefiftymph wrote:
It was copy pasted from a website. surprised to hear that invisible "linefeeds" got added somewhere along the way...
The linefeeds ␊ were likely present in what was copied—in the source—and were not added later.
A carriage return ␍ followed by a linefeed ␊ is one of the ways how ASCII text files are formatted, though there are other ways. It's quite possible the website used these ASCII control characters, rather than HTML tags, for instance.
The basic operations of carriage return ␍ and linefeed ␊ go back to the era of manual typewriters, too. In normal operations, the lever causes both a carriage return ␍ and a linefeed ␊. Computing carried that usage over. This is a very old part of computing.
onefiftymph Said:
"onefiftymph: Why am I getting file name can't be used error?: Is there any reason I cant name a file this: The Lonely House on Adachi Moor in Northern Japan Yoshitoshi 1885.png There are no punctuation marks."
-------
Thank you for the screenshot.
File Extension:
Rid of the apostrophe after the png extension. Report back if that does the trick.
I was experiencing Old Age in real time, the Hex 09 is the TAB character! Oops.
It was copy pasted from a website. surprised to hear that invisible "linefeeds" got added somewhere along the way...
BDAqua wrote:
I was experiencing Old Age in real time, the Hex 09 is the TAB character! Oops.
We could discuss whether your tab ␉ stops should be set every four or every eight positions in your source code files, if you want another throwback to an earlier era. Or every two positions. Or three, if you were odd. 🤭
FWIW, I would get rid of the spaces and the description and use just the address. Many operating systems do not allow spaces in a filename and save the description as file content.
VikingOSX wrote:
When AppleScript wraps long text in a display alert, it uses line feeds for that purpose. I could duplicate those linefeeds here with an AppleScript display alert and by typing the same text as displayed on the OP dialog, or the first paragraph of Steve Job's Stanford address. A screenshot later and selecting the text, copying it to the clipboard and a little Terminal action proves it:
pbpaste | hexdump -C
That’s entirely true, but the word wrapping in the dialog boxes is usually better than what was included above.
That wrapping would usually place Yoshitoshi a line earlier.
It was that errant spacing (yeah, H&J) that sent me toward embedded controls.
Ooops 09 Hex is Horizontal Tab not Linefeed Hex 10!
Ok interesting thanks. Don't think I have a hex editor. Maybe I could try dropping it into TextEdit and converting to plain text.
Yes Text Edit will work fine.
Here's the free Hex Editor I used...
LOL, yep or how to get noise out of a computer using Hex 07 !
Why am I getting file name can't be used error?