Only English Characters

Discussion in 'Plugin Requests' started by EgeTurker, Jul 11, 2019 at 5:24 PM.

  1. Offline

    EgeTurker

    I want to allow only english characters on chat. Thank you
     
  2. Online

    timtower Ninja on the waves Moderator

    @EgeTurker Is this a request or do you need help making it?
     
  3. Offline

    EgeTurker

    Request
     
  4. Online

    timtower Ninja on the waves Moderator

    In that case:
    Moved to plugin requests.
     
  5. Offline

    KarimAKL

    @EgeTurker When you say "english characters", what exactly do you mean? Do you have a list of the characters?
     
  6. Offline

    EgeTurker

    Only all letters on english alphabet
     
  7. Offline

    KarimAKL

    @EgeTurker Minecraft version? Plugin name? Any permissions?
     
  8. Offline

    Tango_

    If you're making this, you might find this useful:

    Code:
        private boolean isEnglish(String text) {
           
            CharsetEncoder asciiEncoder = Charset.forName("US-ASCII").newEncoder();
            CharsetEncoder isoEncoder = Charset.forName("ISO-8859-1").newEncoder();
           
            return  asciiEncoder.canEncode(text) || isoEncoder.canEncode(text);
        }
     
    KarimAKL likes this.
  9. Offline

    KarimAKL

    @Tango_ I was thinking of using regex, i'll look more into that, thanks. :p
    EDIT: @EgeTurker, would you like to allow special characters? (;,:._-*'^¨~`´|?+<>\\/=()[]{}&%¤#\"!@£$€§½ (etc.)) Because it seems like not all of those are allowed by ASCII/ISO. (and i don't know much about chars, so i'm not sure if there's any charset that allows those but still only allows english letters)
     
    Last edited: Jul 12, 2019 at 11:40 PM

Share This Page