I copied a file which contains an '枚' in its filename --> the copy feature made \303\266 out of the '枚'.
Nerdy Workaround:
As I could not find a javascript / typescript based workaround yet, I trigger a shell script after fs/copy with something like:
text=$1
echo $text
echo "${text@E}"
replacing the Octal UTF-8 bytes 303 266 by 枚 :)
ooh lemme at this one those utf8 characters won't even know what hit em
@michael-spengler its ya boy, @cakekindel, comin' back at ya with some need for more information - i'm unable to reproduce this, could you provide the code / shell snippet you're using to trigger the bug, and OS / deno version you're using?
I've written a test to cover this that is (maybe errantly?) passing currently, so I'm thinking it's time to gather more info
(click to expand) code snippet: unit test for copyFile with unicode in name
async function copyFileWithUnicodeInName(): Promise<void> {
const tmpDir = Deno.makeTempDirSync();
const destDir = Deno.makeTempDirSync({ dir: tmpDir, suffix: 'dest' });
const filename = "wow! 枚.txt";
const fromPath = `${tmpDir}/${filename}`;
writeFileString(fromPath, "I have a naughty name!");
const toPath = `${destDir}/${filename}`;
await Deno.copyFile(fromPath, toPath);
const copiedFile = Array.from(Deno.readDirSync(destDir))[0];
try {
assertEquals(copiedFile.name, filename);
} finally {
Deno.removeSync(tmpDir, { recursive: true });
}
},
@cakekindel thank you for your response. I faced this issue on an ubuntu machine - I will check it latest tomorrow evening and send some screenshots...
@cakekindel I isolated things now and tested it separately and I have to admit this issue created by me is a false positive. Sorry for that. I need to code cleaner :)
ah, that would explain things! no harm no foul :smile:
Most helpful comment
ooh lemme at this one those utf8 characters won't even know what hit em