Index: uspace/lib/c/generic/str.c
===================================================================
--- uspace/lib/c/generic/str.c	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/lib/c/generic/str.c	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -995,4 +995,24 @@
 	dest[idx] = '\0';
 	return rc;
+}
+
+/** Get size of UTF-16 string.
+ *
+ * Get the number of words which are used by the UTF-16 string @a ustr
+ * (excluding the NULL-terminator).
+ *
+ * @param ustr UTF-16 string to consider.
+ *
+ * @return Number of words used by the UTF-16 string
+ *
+ */
+size_t utf16_wsize(const uint16_t *ustr)
+{
+	size_t wsize = 0;
+
+	while (*ustr++ != 0)
+		wsize++;
+
+	return wsize;
 }
 
Index: uspace/lib/c/include/str.h
===================================================================
--- uspace/lib/c/include/str.h	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/lib/c/include/str.h	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -99,4 +99,5 @@
 extern int utf16_to_str(char *dest, size_t size, const uint16_t *src);
 extern int str_to_utf16(uint16_t *dest, size_t dlen, const char *src);
+extern size_t utf16_wsize(const uint16_t *ustr);
 
 extern char *str_chr(const char *str, wchar_t ch);
Index: uspace/srv/fs/exfat/exfat_dentry.c
===================================================================
--- uspace/srv/fs/exfat/exfat_dentry.c	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/exfat/exfat_dentry.c	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -130,14 +130,4 @@
 }
 
-size_t exfat_utf16_length(const uint16_t *wstr)
-{
-	size_t len = 0;
-	
-	while (*wstr++ != 0)
-		len++;
-	
-	return len;
-}
-
 /**
  * @}
Index: uspace/srv/fs/exfat/exfat_dentry.h
===================================================================
--- uspace/srv/fs/exfat/exfat_dentry.h	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/exfat/exfat_dentry.h	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -161,7 +161,4 @@
 extern bool exfat_valid_name(const char *);
 
-extern size_t exfat_utf16_length(const uint16_t *);
-
-
 #endif
 
Index: uspace/srv/fs/exfat/exfat_directory.c
===================================================================
--- uspace/srv/fs/exfat/exfat_directory.c	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/exfat/exfat_directory.c	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -371,5 +371,5 @@
 	ds.stream.valid_data_size = 0;
 	ds.stream.data_size = 0;
-	ds.stream.name_size = exfat_utf16_length(wname);
+	ds.stream.name_size = utf16_wsize(wname);
 	ds.stream.hash = host2uint16_t_le(exfat_name_hash(wname, uctable, 
 	    uctable_chars));
Index: uspace/srv/fs/fat/fat_dentry.c
===================================================================
--- uspace/srv/fs/fat/fat_dentry.c	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/fat/fat_dentry.c	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -427,14 +427,4 @@
 }
 
-size_t utf16_length(const uint16_t *wstr)
-{
-	size_t len = 0;
-	
-	while (*wstr++ != 0)
-		len++;
-	
-	return len;
-}
-
 /**
  * @}
Index: uspace/srv/fs/fat/fat_dentry.h
===================================================================
--- uspace/srv/fs/fat/fat_dentry.h	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/fat/fat_dentry.h	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -152,5 +152,4 @@
 
 extern void str_to_ascii(char *, const char *, size_t, uint8_t);
-extern size_t utf16_length(const uint16_t *);
 
 extern bool fat_valid_name(const char *);
Index: uspace/srv/fs/fat/fat_directory.c
===================================================================
--- uspace/srv/fs/fat/fat_directory.c	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/fat/fat_directory.c	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -301,5 +301,5 @@
 			return rc;
 		
-		lfn_size = utf16_length(wname);
+		lfn_size = utf16_wsize(wname);
 		long_entry_count = lfn_size / FAT_LFN_ENTRY_SIZE;
 		if (lfn_size % FAT_LFN_ENTRY_SIZE)
Index: uspace/srv/fs/udf/udf_osta.c
===================================================================
--- uspace/srv/fs/udf/udf_osta.c	(revision 9bf4488cfeb609943351765b36f09895d9b0c67d)
+++ uspace/srv/fs/udf/udf_osta.c	(revision b2906c096fbedc1a9cbec10ad51c63e093dd375c)
@@ -51,20 +51,4 @@
 #include "udf_osta.h"
 #include "udf_cksum.h"
-
-/** Calculate length of UTF-16 string
- *
- * FIXME: This is wrong! UTF-16 is not a fixed-width encoding,
- *        it is a variable-width encoding (mind the surrogate
- *        pairs).
- *
- */
-static size_t utf16_length(uint16_t *string) {
-	size_t len = 0;
-	
-	while (*string++ != 0)
-		len++;
-	
-	return len;
-}
 
 /** Illegal UNIX characters are NULL and slash.
@@ -296,5 +280,5 @@
 		ucode_chars =
 		    udf_uncompress_unicode(len, (uint8_t *) id, raw_name, MAX_BUF);
-		ucode_chars = min(ucode_chars, utf16_length(raw_name));
+		ucode_chars = min(ucode_chars, utf16_wsize(raw_name));
 		nice_uchars =
 		    udf_translate_name(unix_name, raw_name, ucode_chars);
