Index: uspace/lib/c/generic/str.c
===================================================================
--- uspace/lib/c/generic/str.c	(revision 042a725640ef06297491fa808ed926ee42687a12)
+++ uspace/lib/c/generic/str.c	(revision fc97128da130f36e8a48da46d4c80a2f5ff6765c)
@@ -633,4 +633,39 @@
 	return rc;
 }
+
+int str_to_utf16(uint16_t *dest, size_t size, const char *src)
+{
+	int rc=EOK;
+	size_t offset=0;
+	size_t idx=0;
+	wchar_t c;
+
+	assert(size > 0);
+	
+	while ((c = str_decode(src, &offset, STR_NO_LIMIT)) != 0) {
+		if (c > 0x10000) {
+			if (idx+2 >= size-1) {
+				rc=EOVERFLOW;
+				break;
+			}
+			c = (c - 0x10000);
+			dest[idx] = 0xD800 | (c >> 10);
+			dest[idx+1] = 0xDC00 | (c & 0x3FF);
+			idx++;
+		} else {
+			 dest[idx] = c;
+		}
+
+		idx++;
+		if (idx >= size-1) {
+			rc=EOVERFLOW;
+			break;
+		}
+	}
+
+	dest[idx] = '\0';
+	return rc;
+}
+
 
 /** Convert wide string to new string.
Index: uspace/lib/c/include/str.h
===================================================================
--- uspace/lib/c/include/str.h	(revision 042a725640ef06297491fa808ed926ee42687a12)
+++ uspace/lib/c/include/str.h	(revision fc97128da130f36e8a48da46d4c80a2f5ff6765c)
@@ -79,4 +79,5 @@
 extern int str_to_wstr(wchar_t *dest, size_t dlen, const char *src);
 extern int utf16_to_str(char *dest, size_t size, const uint16_t *src);
+extern int str_to_utf16(uint16_t *dest, size_t size, const char *src);
 
 extern char *str_chr(const char *str, wchar_t ch);
