static private void _writeDecRef(Writer out,char ch) throws IOException {
  if (ch == '\u20ac') {
    out.write("&euro;");
    return;
  }
  out.write("&#");
  int i=(int)ch;
  if (i > 10000) {
    out.write('0' + (i / 10000));
    i=i % 10000;
    out.write('0' + (i / 1000));
    i=i % 1000;
    out.write('0' + (i / 100));
    i=i % 100;
    out.write('0' + (i / 10));
    i=i % 10;
    out.write('0' + i);
  }
 else   if (i > 1000) {
    out.write('0' + (i / 1000));
    i=i % 1000;
    out.write('0' + (i / 100));
    i=i % 100;
    out.write('0' + (i / 10));
    i=i % 10;
    out.write('0' + i);
  }
 else {
    out.write('0' + (i / 100));
    i=i % 100;
    out.write('0' + (i / 10));
    i=i % 10;
    out.write('0' + i);
  }
  out.write(';');
}

static private void _writeDecRef ( Writer out , char ch ) throws IOException { if ( ch == '€' ) { out . write ( "&euro;" ) ; return ; } out . write ( "&#" ) ; int i = ( int ) ch ; if ( i > 10000 ) { out . write ( '0' + ( i / 10000 ) ) ; i = i % 10000 ; out . write ( '0' + ( i / 1000 ) ) ; i = i % 1000 ; out . write ( '0' + ( i / 100 ) ) ; i = i % 100 ; out . write ( '0' + ( i / 10 ) ) ; i = i % 10 ; out . write ( '0' + i ) ; } else if ( i > 1000 ) { out . write ( '0' + ( i / 1000 ) ) ; i = i % 1000 ; out . write ( '0' + ( i / 100 ) ) ; i = i % 100 ; out . write ( '0' + ( i / 10 ) ) ; i = i % 10 ; out . write ( '0' + i ) ; } else { out . write ( '0' + ( i / 100 ) ) ; i = i % 100 ; out . write ( '0' + ( i / 10 ) ) ; i = i % 10 ; out . write ( '0' + i ) ; } out . write ( ';' ) ; }
writes a character as a decimal escape . hex escapes are smaller than the decimal version , but netscape didn ' t support hex escapes until 4 . 7 . 4 .
