Accents & NBT fils issue when passing my project to Maven (1.18, UTF-8)

Discussion in 'Plugin Development' started by RaphLeFlamboyant, Apr 8, 2022.

Thread Status:
Not open for further replies.
  1. Hello there,

    I'm struggling with loading structures embeded in my plugin. I updated my project to 1.18, using Maven configuration proposed by the Minecraft addon for IntelliJ IDE. From then all my "special characters" like é, è, etc are replaced by the <?> character.

    That was not a major issue to me until I finally found that it's linked to the failure of loading structure files into the world.

    I decide to make a test : read the getResource input stream and write it into a file. Ont the picture you can see the difference between the original (left) and the exported one (right). Some characters are replaced by the 3F character so obviously it's corrupted and the structure loading crashes.

    I don't understand from where it comes ... Configuring explicitly UTF in pom.xml file or in java command line arguments doesn't change anything. I saw many person having an encoding problem too but most of them only had problem with ColorChat character (§) so people just answered using ChatColor instead but this time the true cause of this have to be solved.

    Does anyone loads structure files in his projet using Maven in IntelliJ so we can compare what's wrong in my case ?

    Ok thing seems a bit more tricky than I thought.

    My mistake is that the snreenshot is a comparison between the original file and the one I got in the resource if I use a project.build.sourceEncoding = windows-1252. If I use UTF-8 encoding it's completely messed up. With windows-1252 encoding .loadStructure nor NBTInputStream are able to read the file.

    So I more or less solved the encoding problem for messages but it's not what really matters here, I'll change the topic title when my problem is trully solved.

    • I don't understand why UTF-8 encoding totally breaks the NBT files
    • I don't understand why its broken anyway using the windows-1252 encoding
    I saw womeone usedNBT files as resource on this topic, I'm going to ask him.
    https://bukkit.org/threads/pasting-pre-built-structure-from-one-location-to-another.487791/
     

    Attached Files:

    Last edited by a moderator: Apr 8, 2022
Thread Status:
Not open for further replies.

Share This Page