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

Vorbisfile fails to Open A Unicode String Filename (Windows) #31

Open
atkawa7 opened this issue Oct 15, 2017 · 5 comments
Open

Vorbisfile fails to Open A Unicode String Filename (Windows) #31

atkawa7 opened this issue Oct 15, 2017 · 5 comments

Comments

@atkawa7
Copy link

atkawa7 commented Oct 15, 2017

On these lines https://github.com/xiph/vorbis/blob/master/lib/vorbisfile.c#L1009-L1017. Had to add an additional method on windows.

#ifdef _WIN32
int ov_wfopen(const wchar_t *path, OggVorbis_File *vf)
{
        int ret;
        FILE *f = _wfopen(path, L"rb");
        if (!f)
                return -1;

        ret = ov_open(f, vf, NULL, 0);
        if (ret)
                fclose(f);
        return ret;
}
#endif
@erikd
Copy link
Member

erikd commented Oct 15, 2017

VorbisFile uses UTF-8 Unicode, not Windows' UTF-16.

@atkawa7
Copy link
Author

atkawa7 commented Oct 15, 2017

@erikd True. Its utf-16. Miss communication on my part.

@erikd
Copy link
Member

erikd commented Oct 15, 2017

I maintain another library much like Vorbis. To address this issue, Windows users convert the UTF-`6 file name to UTF-8 before passing it to my library. I don't program on Windows so I have no idea how this is done.

@atkawa7
Copy link
Author

atkawa7 commented Oct 15, 2017

@erikd I had tried doing it before but it doesn't work. I pass in const char * from a method that converts wchar_t* to char* it returns an error. The other codecs (opus/flac ) works fine. So I think there must be an issue with that ov_fopen method

@atkawa7
Copy link
Author

atkawa7 commented Oct 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants