Lazarus 0.9.31 编译 BASS 音频库 的例子,不能播放中文名的 MP3 的解决。

{使用 Lazarus + Bass 来测试跨平台,在 Ubuntu 中很正常,在 Windows 中只能播放英文名的 MP3,
看了一下官方例子,应该是以下的问题。
}
var
  f: PChar;
  s: string;

begin
  if not OpenDialog2.Execute then Exit;
  s := OpenDialog2.FileName;

  //f := Pchar(s);
  f:= Pchar(Utf8ToAnsi(s)); //修改为这个,该死的编码。。。

  strs[strc] := BASS_StreamCreateFile(False, f ,0, 0, 0);
  if strs[strc] <> 0 then
  begin
    ListBox3.Items.Add(OpenDialog2.FileName);
    Inc(strc);
  end
  else
    Error('Error creating stream!');
end; 
原文地址:https://www.cnblogs.com/sail2000/p/1981513.html