Skip to content

Windows: support info.size on wide-character systems (a.k.a. the C++17 upgrade) #3943

@zkz098

Description

@zkz098

Possible bug

Is this a possible bug in a feature of sharp, unrelated to installation?

  • Running npm install sharp completes without error.
  • Running node -e "require('sharp')" completes without error.

If you cannot confirm both of these, please open an installation issue instead.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System:
    OS: Windows 11 10.0.22635
    CPU: (16) x64 AMD Ryzen 7 5800U with Radeon Graphics
    Memory: 5.94 GB / 15.31 GB
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.2.4 - C:\Program Files\nodejs\npm.CMD
    pnpm: 8.12.0 - ~\AppData\Local\pnpm\pnpm.CMD
  npmPackages:
    sharp: ^0.33.2 => 0.33.2

What are the steps to reproduce?

For any input image processed by the Sharp library using the toFile operation, when the output path contains non-ASCII characters, the info.size of the toFile operation will become undefined instead of being a numeric value.

What is the expected behaviour?

The info.size of the toFile function should be a numeric value.

Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this problem

import sharp from "sharp"

const path1 = './images/out.png'
const path2 = './图像/out.png'

const image = sharp('./images/404.png')
image
    .toFile(path2)
    .then((info)=>{
        console.log(info.size)
    })

It runs well when using path1, but when using path2, info.size becomes undefined.

Please provide sample image(s) that help explain this problem

无标题6

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions