Solved Polish letters in config.yml

Discussion in 'Plugin Development' started by Krolewicz, Jul 24, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    Krolewicz

    Hello,
    I want to make the plugin with polish letter support, but I have a problem with utf-8 because when I get from config.yml StringList and I get word from this list I have this error:
    https://drive.google.com/open?id=1uMed480yhNgrtuDqZihSgL8VZCmjnf1G

    My code to load config:
    Code:
    private static FileConfiguration config;
        String path = this.getDataFolder().getAbsolutePath()+File.separator+"config.yml";
        File file = new File(path);
    
    onEnable:
    Code:
    config = new YamlConfiguration();
            try {
                config.load(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")));
            } catch (FileNotFoundException e) {
            
                e.printStackTrace();
            } catch (IOException e) {
            
                e.printStackTrace();
            } catch (InvalidConfigurationException e) {
            
                e.printStackTrace();
            }
    
    What is wrong?
    Why, when I get StringList from confg polish letter is not supported.
    StringList:
    Code:
    public static List<String> allowPolishWord;
    
    Code:
    allowPolishWord = getConfig().getStringList("word..polishWord");
    
    Thank you for your help, because I know you do not have to do it.
    Regard,
    Krolewicz

    @Edit:
    @Down:
    Thank you very much, but I did not think about it ...
    I'm very stupid :/
    Thank you and close thread.
    @KarimAKL
    I changed to utf-8 and it works
     
    Last edited: Jul 29, 2018
  2. Offline

    xGhOsTkiLLeRx

    Have you made sure that the actual config.yml is saved as an UTF-8 file?
     
    Krolewicz likes this.
  3. Offline

    KarimAKL

    Remember to change the title prefix to “Solved”.
    Also, how did you fix it?
     
    Last edited by a moderator: Jul 25, 2018
Thread Status:
Not open for further replies.

Share This Page