ARRP

ARRP

3M Downloads

Translations for non english characters produce question marks in game

enchantinggg4 opened this issue · 5 comments

commented

For japanese, cyrillic and I'm pretty sure for almost all non latin characters

val lang = JLang() .item(Identifier("krp", "magma_helmet"), "私は自分自身をたわごと")
ResourcePack.addLang(Identifier("krp:ru_ru"), lang)

game will show ????? instead of letters in game

commented

Yes, it generates file json files in cp1251 encoding(windows cyrillic)
Howewer all my code files are in utf-8.

commented

RuntimeResourcePackImpl:

private static byte[] serialize(Object object) {
		UnsafeByteArrayOutputStream ubaos = new UnsafeByteArrayOutputStream();
		OutputStreamWriter writer = new OutputStreamWriter(ubaos);
		GSON.toJson(object, writer);
		try {
			writer.close();
		} catch(IOException e) {
			throw new RuntimeException(e);
		}
		return ubaos.getBytes();
	}

If no charset is provided, it OutputStreamWriter will use system's default charset
I think its better to set UTF-8 here or add an option to override charset somewhere in resource pack class.

I can experiment locally and if it is the case, ill make a pr

commented

I got it
I'm on 1.18.2, so i am using ARP 0.5.7, which doesn't have the fix for it
832b788#diff-0525a3f0d683be2e4e572c0caa32e5cd3d90c026fbb7a2cfee77fd4c29e0db55R525
It came as a crash fix for 1.19

So 0.5.7 always writes system's default charset
Is there a chance to backport this change to 1.18 version?

commented

it might be that the java file you wrote those characters in isn't utf8 encoded

commented

can you verify with a .dump on your resource pack that the json contains ???s