Reads a utf-8 string
173001
public int readUTF8ByByteLength(char []buffer, int offset, int byteLength)
    throws IOException
  {
    int k = 0;
    for (int i = 0; i < byteLength; i++) {
      if (_readLength <= _readOffset) {
        readBuffer();
      }

      int ch = _readBuffer[_readOffset++] & 0xff;

      if (ch < 0x80) {
        buffer[k++] = (char) ch;
      }
      else if ((ch & 0xe0) == 0xc0) {
        int c2 = read();
        i += 1;
        buffer[k++] = (char) (((ch & 0x1f) << 6) + (c2 & 0x3f));
      }
      else {
        int c2 = read();
        int c3 = read();

        i += 2;
        buffer[k++] = (char) (((ch & 0x1f) << 12)
                              + ((c2 & 0x3f) << 6)
                              + ((c3 & 0x3f)));
      }
    }

    return k;
  }
417517
protected String readStringImpl(int length)
        throws IOException
    {
        StringBuffer sb = new StringBuffer();

        for (int i = 0; i < length; i++) {
            int ch = is.read();

            if (ch < 0x80)
                sb.append((char) ch);
            else if ((ch & 0xe0) == 0xc0) {
                int ch1 = is.read();
                int v = ((ch & 0x1f) << 6) + (ch1 & 0x3f);

                sb.append((char) v);
            }
            else if ((ch & 0xf0) == 0xe0) {
                int ch1 = is.read();
                int ch2 = is.read();
                int v = ((ch & 0x0f) << 12) + ((ch1 & 0x3f) << 6) + (ch2 & 0x3f);

                sb.append((char) v);
            }
            else
                throw new IOException("bad utf-8 encoding");
        }

        return sb.toString();
    }
59972
def read_string(data, length_fmt="H"):
    
    (length,), data = read(data, ">{0}".format(length_fmt))
    ba, data = data[:length], data[length:]
    return to_unicode(ba), data
930176
public char readChar () throws KryoException {
		require(2);
		int p = position;
		position = p + 2;
		return (char)((buffer[p] & 0xFF) | ((buffer[p + 1] & 0xFF)) << 8);
	}
391992
function read_raw_string(buf, encoding) {
  var len = buf.readUInt16BE();
  return buf.toString(encoding || 'utf8', len);
}
653421
def ReadString(self):
        
        length = self.ReadUInt8()
        return self.unpack(str(length) + 's', length)
329207
def Read(self):
    
    input_string = self._file_object.readline()

    if isinstance(input_string, py2to3.BYTES_TYPE):
      try:
        input_string = codecs.decode(input_string, self._encoding, self._errors)
      except UnicodeDecodeError:
        if self._errors == 'strict':
          logging.error(
              'Unable to properly read input due to encoding error. '
              'Switching to error tolerant encoding which can result in '
              'non Basic Latin (C0) characters to be replaced with "?" or '
              '"\\ufffd".')
          self._errors = 'replace'

        input_string = codecs.decode(input_string, self._encoding, self._errors)

    return input_string
1012539
def readme(filename, encoding='utf8'):
    

    with io.open(filename, encoding=encoding) as source:
        return source.read()
19488
def read(path, encoding="UTF-8"):
    """"""
    with OPEN_FUNC(path, 'rb') as _file:
        cont = _file.read()
        return cont.decode(encoding)
769901
def read_string_from_file(path, encoding="utf8"):
  
  with codecs.open(path, "rb", encoding=encoding) as f:
    value = f.read()
  return value
248441
public static String readString(ByteBuffer byteBuffer) {

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        int read;
        while ((read = byteBuffer.get()) != 0) {
            out.write(read);
        }
        return Utf8.convert(out.toByteArray());
    }
655974
public static String readStr(ByteBuffer buffer, Charset charset) {
		return StrUtil.str(readBytes(buffer), charset);
	}
527015
def read_character_string(self):
        """"""
        length = ord(self.data[self.offset])
        self.offset += 1
        return self.read_string(length)
1144278
public static int utf8Length(String string) {
        CharacterIterator iter = new StringCharacterIterator(string);
        char ch = iter.first();
        int size = 0;
        while (ch != CharacterIterator.DONE) {
            if ((ch >= 0xD800) && (ch < 0xDC00)) {
                // surrogate pair?
                char trail = iter.next();
                if ((trail > 0xDBFF) && (trail < 0xE000)) {
                    // valid pair
                    size += 4;
                } else {
                    // invalid pair
                    size += 3;
                    iter.previous(); // rewind one
                }
            } else if (ch < 0x80) {
                size++;
            } else if (ch < 0x800) {
                size += 2;
            } else {
                // ch < 0x10000, that is, the largest char value
                size += 3;
            }
            ch = iter.next();
        }
        return size;
    }
580573
void readString(StringBuilder sb)
    throws IOException
  {
    while (true) {
      int ch = read();
      int len;
    
      switch (ch) {
      default:
        _peek = ch;
        return;
      
      case 0x00: case 0x01: case 0x02: case 0x03:
      case 0x04: case 0x05: case 0x06: case 0x07:
      case 0x08: case 0x09: case 0x0a: case 0x0b:
      case 0x0c: case 0x0d: case 0x0e: case 0x0f:

      case 0x10: case 0x11: case 0x12: case 0x13:
      case 0x14: case 0x15: case 0x16: case 0x17:
      case 0x18: case 0x19: case 0x1a: case 0x1b:
      case 0x1c: case 0x1d: case 0x1e: case 0x1f:
        len = ch - 0x00;
        readString(sb, len);
        return;
      
      case 0x30: case 0x31: case 0x32: case 0x33:
        len = ((ch - 0x30) << 8) + read();
        readString(sb, len);
        return;
        
      case 'S':
        len = readShort();
        readString(sb, len);
        return;
        
      case 'R':
        len = readShort();
        readString(sb, len);
        break;
      }
    }
  }
949796
def utf8(value):
    
    if isinstance(value, _UTF8_TYPES):
        return value
    if not isinstance(value, unicode_type):
        raise TypeError(
            "Expected bytes, unicode, or None; got %r" % type(value)
        )
    return value.encode("utf-8")
630143
protected String readUTF()
        throws IOException
    {
        int len = (is.read() << 8) + is.read();

        StringBuffer sb = new StringBuffer();

        while (len > 0) {
            int d1 = is.read();

            if (d1 < 0)
                return sb.toString();
            else if (d1 < 0x80) {
                len--;
                sb.append((char) d1);
            }
            else if ((d1 & 0xe0) == 0xc0) {
                len -= 2;
                sb.append(((d1 & 0x1f) << 6) + (is.read() & 0x3f));
            }
            else if ((d1 & 0xf0) == 0xe0) {
                len -= 3;
                sb.append(((d1 & 0x0f) << 12) +
                    ((is.read() & 0x3f) << 6) +
                    (is.read() & 0x3f));
            }
            else
                throw new IOException("utf-8 encoding error");
        }

        return sb.toString();
    }