If the multibyte character encoding is state-dependent (codecvt::encoding() returned -1) or variable-length (codecvt::encoding() returned 0) and the offset off is not 0, fails immediately: this function cannot determine the number of bytes that correspond to off characters.