oldlocale = setlocale(LC_CTYPE, NULL);
setlocale(LC_CTYPE, "utf-8");
- /* uvchr_to_utf8(buf, chr) or Encoding::_bytes_to_utf8(sv, "UCS-2BE"); */
wlen = wcsrtombs(NULL, (const wchar_t **)&wbuf, wlen, NULL);
buf = (char *) safemalloc(wlen+1);
wcsrtombs(buf, (const wchar_t **)&wbuf, wlen, NULL);
setlocale(LC_CTYPE, "utf-8");
wbuf = (wchar_t *) safemalloc(wlen);
- /* utf8_to_uvchr_buf(pathname, pathname + wlen, wpath) or Encoding::_utf8_to_bytes(sv, "UCS-2BE"); */
wlen = mbsrtowcs(wbuf, (const char**)&buf, wlen, &mbs);
if (oldlocale) setlocale(LC_CTYPE, oldlocale);
oldlocale = setlocale(LC_CTYPE, NULL);
setlocale(LC_CTYPE, "utf-8");
- /* utf8_to_uvchr_buf(src_path, src_path + wlen, wpath) or Encoding::_utf8_to_bytes(sv, "UCS-2BE"); */
wlen = mbsrtowcs(wpath, (const char**)&src_path, wlen, &mbs);
if (wlen > 0)
err = cygwin_conv_path(what, wpath, wbuf, wlen);
else setlocale(LC_CTYPE, "C");
SETLOCALE_UNLOCK;
- } else { /* use bytes; assume already ucs-2 encoded bytestream */
+ } else { /* use bytes; assume already UTF-16 encoded bytestream */
err = cygwin_conv_path(what, src_path, wbuf, wlen);
}
if (err == ENOSPC) { /* our space assumption was wrong, not enough space */
setlocale(LC_CTYPE, "utf-8");
if (!IN_BYTES) {
mbstate_t mbs;
- /* utf8_to_uvchr_buf(src_path, src_path + wlen, wpath) or Encoding::_utf8_to_bytes(sv, "UCS-2BE"); */
wlen = mbsrtowcs(wpath, (const char**)&src_path, wlen, &mbs);
if (wlen > 0)
err = cygwin_conv_path(what, wpath, wbuf, wlen);
- } else { /* use bytes; assume already ucs-2 encoded bytestream */
+ } else { /* use bytes; assume already UTF-16 encoded bytestream */
err = cygwin_conv_path(what, src_path, wbuf, wlen);
}
if (err == ENOSPC) { /* our space assumption was wrong, not enough space */