简体   繁体   中英

Microsoft Speech to Text with non-ASCII file names

I'm playing with the Microsoft Speech API and the sample code at https://github.com/Azure-Samples/cognitive-services-speech-sdk/tree/master/samples/cpp/windows/console . The SpeechContinuousRecognitionWithFile() function in speech_recognition_samples.cpp is almost completely what I need.

Modifying this function, I replaced the name of the input file by that of another file which happened to be on my disk, "Blutgefäße.wav" . This resulted in a std::range_error exception in the FromWavFileInput call, which could only be fixed by renaming the file to "Blutgefaesse.wav" .

Is it expected behavior of this function to crash with international file names? Do I have to use a Unicode version of the API? If so, where do I find it?

The solution is to supply non-ASCII file names in UTF-8 coding:

u8"Blutgefäße.wav"

The transcript, by the way, is also UTF-8 encoded.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM