code: public void printString(String v, int offset, int length)
          throws IOException
      {
          for (int i = 0; i < length; i++) {
              char ch = v.charAt(i + offset);
  
              if (ch < 0x80)
                  os.write(ch);
              else if (ch < 0x800) {
                  os.write(0xc0 + ((ch >> 6) & 0x1f));
                  os.write(0x80 + (ch & 0x3f));
              }
              else {
                  os.write(0xe0 + ((ch >> 12) & 0xf));
                  os.write(0x80 + ((ch >> 6) & 0x3f));
                  os.write(0x80 + (ch & 0x3f));
              }
          }
      }
docs: Prints a string to the stream, encoded as UTF-8
  
  @param v the string to print.