Re: [text] Invalid unicode sequences on .substring of RandomStringGenerator

2017-09-11 Thread Amey Jadiye
Thanks much for checking this Bruno. On Mon, Sep 11, 2017 at 3:05 PM, Bruno P. Kinoshita < brunodepau...@yahoo.com.br.invalid> wrote: > Hi Amey, > > You created a byte array from the original string (which may contain > surrogate chars). But then you created a copy string with `final String > cop

Re: [text] Invalid unicode sequences on .substring of RandomStringGenerator

2017-09-11 Thread Bruno P. Kinoshita
Hi Amey, You created a byte array from the original string (which may contain surrogate chars). But then you created a copy string with `final String copy = new String(bytes, charset);`. There will be encoding to UTF-8, which may fail to encode some values, leading to the error you reported I s