public static char [ ] replace ( final char [ ] input ) { int surLow = 0xD800 ; int surHgh = 0xDFFF ; int end = input . length ; char [ ] output = new char [ end ] ; for ( int i = 0 ; i < end ; i ++ ) { if ( ( int ) input [ i ] >= surLow && input [ i ] <= surHgh ) { output [ i ] = ' ' ; } else { output [ i ] = input [ i ] ; } } return output ; }
Replaces all surrogates characters with ? .