llfbandit / record

Audio recorder from microphone to a given file path. No external dependencies, MediaRecorder is used for Android an AVAudioRecorder for iOS.
https://pub.dev/packages/record
245 stars 203 forks source link

[Windows] Cant recording when path contains CJK character #422

Closed ZhuJHua closed 3 weeks ago

ZhuJHua commented 1 month ago

Package version record: 5.1.2

Environment

Describe the bug

Cant recording on windows, I used the path_provider package to get the cache directory of the application.The path contains a username which is a CJK character like C:\Users\住京华\AppData\Local\cn.yooss\mood_diary\audio-0192ce6d-ad7c-7386-9ac5-69adf5557f64.m4a. Then recording threw this exception after calling the start method. image

However, when using a latin only path, it works well.

My Code This is my code

state.fileName = 'audio-${const Uuid().v7()}.m4a';
await audioRecorder.start(
          const RecordConfig(androidConfig: AndroidRecordConfig(muteAudio: true, useLegacy: true)),
          path: Utils().fileUtil.getCachePath(state.fileName));

The getCachePath() method is just used the getApplicationCacheDirectory() method in path_provider package.

It work well on Android devices, but not windows.

llfbandit commented 3 weeks ago

Thanks for the report. This should be fixed with the corresponding commit but I can't test it myself. So feedback is very welcome!

ZhuJHua commented 3 weeks ago

It works fine as you can publish it into pub, thanks a lot!🥰