Skip to content

Issues with unicode characters in filenames on Windows 10 (Unix-like situation is currently unknown to me). #35

@thalassocracy

Description

@thalassocracy

https://github.com/JuliaAudio/LibSndFile.jl/blob/master/src/libsndfile_h.jl#L122

function sf_open(fname::String, mode, sfinfo)
    filePtr = ccall((:sf_open, libsndfile), Ptr{Cvoid},
                    (Cstring, Int32, Ref{SF_INFO}),
                    fname, mode, sfinfo)

    if filePtr == C_NULL
        error("LibSndFile.jl error while opening $fname: ", sf_strerror(C_NULL))
    end

    filePtr
end

Fixed on Windows 10 by changing Cstring to Cwstring and sf_open to sf_wchar_open.

The sf_wchar_open change is definitely Windows-specific, but there's a chance that opening filenames with wide characters in them on Unix-like systems will also benefit from changing Cstring to Cwstring. I will experiment with this at some point in the near future on Linux.

If I find that Linux also requires Cwstring, I will open a pull req with that change (but not the Windows-specific sf_wchar_open).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions