1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:28:00 +08:00

Change .olz to use UTF-8 encoding

This commit is contained in:
Dean Herbert 2024-04-30 21:40:04 +08:00
parent c8f7f2215b
commit a3213fc36d
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,8 @@ namespace osu.Game.Database
{ {
} }
protected override bool UseFixedEncoding => false;
protected override string FileExtension => @".olz"; protected override string FileExtension => @".olz";
} }
} }

View File

@ -3,6 +3,7 @@
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
@ -23,6 +24,11 @@ namespace osu.Game.Database
public abstract class LegacyArchiveExporter<TModel> : LegacyExporter<TModel> public abstract class LegacyArchiveExporter<TModel> : LegacyExporter<TModel>
where TModel : RealmObject, IHasNamedFiles, IHasGuidPrimaryKey where TModel : RealmObject, IHasNamedFiles, IHasGuidPrimaryKey
{ {
/// <summary>
/// Whether to always use Shift-JIS encoding for archive filenames (like osu!stable did).
/// </summary>
protected virtual bool UseFixedEncoding => true;
protected LegacyArchiveExporter(Storage storage) protected LegacyArchiveExporter(Storage storage)
: base(storage) : base(storage)
{ {
@ -32,7 +38,7 @@ namespace osu.Game.Database
{ {
using (var writer = new ZipWriter(outputStream, new ZipWriterOptions(CompressionType.Deflate) using (var writer = new ZipWriter(outputStream, new ZipWriterOptions(CompressionType.Deflate)
{ {
ArchiveEncoding = ZipArchiveReader.DEFAULT_ENCODING ArchiveEncoding = UseFixedEncoding ? ZipArchiveReader.DEFAULT_ENCODING : new ArchiveEncoding(Encoding.UTF8, Encoding.UTF8)
})) }))
{ {
int i = 0; int i = 0;