mirror of
https://github.com/real-zony/ZonyLrcToolsX.git
synced 2025-07-01 20:30:41 +00:00
feat: Supports UTF-8 BOM encoding.
This commit is contained in:
parent
bfd89e9d82
commit
5dbabab5a6
@ -125,6 +125,8 @@ globalOption:
|
||||
|
||||
详细信息请参考: [MSDN Encoding 列表](https://learn.microsoft.com/en-us/dotnet/api/System.Text.Encoding.GetEncodings?view=net-6.0#examples),使用 `identifier and name` 作为参数值填入 `config.yaml` 文件当中的 `fileEncoding`。
|
||||
|
||||
> 针对 UTF-8 BOM 格式,程序进行了特殊处理,请在 `fileEncoding` 里面填写 "utf-8-bom" 以支持。
|
||||
|
||||
#### 支持的歌词源
|
||||
|
||||
| 歌词源 | 默认优先级 |
|
||||
|
@ -118,6 +118,13 @@ public class LyricsDownloader : ILyricsDownloader, ISingletonDependency
|
||||
private byte[] Utf8ToSelectedEncoding(LyricsItemCollection lyrics)
|
||||
{
|
||||
var supportEncodings = Encoding.GetEncodings();
|
||||
|
||||
// If the encoding is UTF-8 BOM, add the BOM to the front of the lyrics.
|
||||
if (_options.Provider.Lyric.Config.FileEncoding == "utf-8-bom")
|
||||
{
|
||||
return Encoding.UTF8.GetPreamble().Concat(lyrics.GetUtf8Bytes()).ToArray();
|
||||
}
|
||||
|
||||
if (supportEncodings.All(x => x.Name != _options.Provider.Lyric.Config.FileEncoding))
|
||||
{
|
||||
throw new ErrorCodeException(ErrorCodes.NotSupportedFileEncoding);
|
||||
|
@ -1,11 +1,8 @@
|
||||
New Features:
|
||||
|
||||
- CLI 提供了一个更新检查功能,在程序启动的时候会检测最新的版本。
|
||||
- 支持从酷我音乐搜索歌词。
|
||||
New Features: NONE
|
||||
|
||||
Breaking Changes: None
|
||||
Enhancement:
|
||||
- 基于 MusicDecrypto 提供歌曲解密功能,支持 40 种格式的文件,具体支持格式请自己尝试。
|
||||
- 支持 UTF-8 BOM 编码,以解决部分设备乱码的问题。
|
||||
|
||||
Fixed Bugs:
|
||||
- None
|
Loading…
x
Reference in New Issue
Block a user