The Wayback Machine - http://web.archive.org/web/20200821223137/https://github.com/denoland/deno/issues/7119
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs/copy feature seems to have trouble with special characters like e.g. ä, ü, ö ... #7119

Open
michael-spengler opened this issue Aug 19, 2020 · 3 comments

Comments

@michael-spengler
Copy link

@michael-spengler michael-spengler commented Aug 19, 2020

I copied a file which contains an 'ö' in its filename --> the copy feature made \303\266 out of the 'ö'.

@michael-spengler
Copy link
Author

@michael-spengler michael-spengler commented Aug 19, 2020

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 ö :)

@cakekindel
Copy link

@cakekindel cakekindel commented Aug 19, 2020

ooh lemme at this one those utf8 characters won't even know what hit em

@cakekindel
Copy link

@cakekindel cakekindel commented Aug 20, 2020

@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 });
    }
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.