Mtihc / TreasureChest

The TreasureChest plugin for CraftBukkit
dev.bukkit.org/server-mods/treasurechest
10 stars 39 forks source link

RpgItems 2 and TreasureChest #75

Open Shadow0X90 opened 10 years ago

Shadow0X90 commented 10 years ago

When ever I place a custom rpg item into a treasure chest it changes into a string of color codes and removes all of its ability's on my dedicated debian server. Before 2014-01-19_12 42 20 After 2014-01-19_12 42 33

On my local server it works fine but on the dedicated it breaks. Any help?

Mtihc commented 10 years ago

wtf... probably has something to do with encoding shizzle. UTF-8 and stuff whatever teh fuck.

Are you running a Linux server? I'm not sure if that has anything to do with it.

Shadow0X90 commented 10 years ago

Yup its a linux server.

Mtihc commented 10 years ago

There was a similar issue before https://github.com/Mtihc/TreasureChest/issues/55

I got help that time, from @Codisimus I was hoping that would solve the problem. Clearly it does not.

Maybe you can try to convert the .yml files to UTF-8 encoding. Eventhough I thought it should work for any encoding. I think the easiest way is to create a new file, rather than convert. Make a new file and try to set the encoding to UTF-8. And then copy and paste into that file.

In the meantime I will ask/look around on forums. Somebody must have the answer.

Codisimus commented 10 years ago

The fix that I helped you with before does not always work. It mostly depends on the default encoding of the system. If you are able to, set it to UTF-8 (I have no idea how that is done in linux). But if you have a host then try to convince them to do it for you. Most hosts proly won't bother though. I would suggest that you manually convert the files. I use Notepad++ in order to do so. I hope that helps.

Mtihc commented 10 years ago

Thanks for clearing things up @Codisimus . I feel like I'm in over my head with this issue.

So it would help to set the default encoding to UTF-8 in the O.S. (in this case Linux). I hope this helps @Shadow0X90 and @Noshire .

I wish I understood the full story. I guess my first question would be:

Which encoding does not support the special characters that are needed for colors? I understand we should aim for UTF-8, right?

Can I control in which encoding my plugin saves/loads the file? (that would solve the issue right? Unless the user edits the file manually but that's not my problem) I currently don't specify any encoding when saving a file. So that's probably when it uses the O.S. default encoding setting?

Codisimus commented 10 years ago

many may support the symbol but Bukkit specifically uses symbols which are in UTF-8 encoding. The methods you have are suppose to save and load in UTF-8, which usually works, but I guess it doesn't if the default encoding is specifically set to something else. There may be a hack to fix it but I haven't found it yet myself. If you don't think you specify encoding already, look at how I do it. https://github.com/Codisimus/PhatLoots/blob/master/src/com/codisimus/plugins/phatloots/PhatLoot.java#L1069 https://github.com/Codisimus/PhatLoots/blob/master/src/com/codisimus/plugins/phatloots/PhatLoots.java#L508

Mtihc commented 10 years ago

Thanks for the links. I see some differences. I should've looked that up myself.

Codisimus commented 10 years ago

no worries, that fixed the issue for most users of PhatLoots but I still see this problem once in a while. It may be enough to help these two folks.

Nicklander commented 10 years ago

I got exactly the same problem ! The Metadata changes to +#1 (388:2#3 to 388:2#4) My .yml files are in the UTF-8 encoding, but still got the same ! http://pastebin.com/8nCkyue8 It works fine on my Windows testserver, but on my Linux Debian 64 Bit it does me this...

Thank you very much for your help !

Nicklander commented 10 years ago

I think that your plugin is saving the files correctly, but it just can't read them, when using your plugin on Linux Debian. As I said before, the encoding is correct, the server is encoding the files in "UTF-8 without BOM"