Index: kernel/generic/src/lib/string.c
===================================================================
--- kernel/generic/src/lib/string.c	(revision 06b785f8cd841eaeec20587b753477850c12723b)
+++ kernel/generic/src/lib/string.c	(revision d09f84e67ea1b8e6963a334fc5947e9c6441b7f9)
@@ -41,4 +41,5 @@
 #include <arch/asm.h>
 #include <arch.h>
+#include <errno.h>
 #include <console/kconsole.h>
 
@@ -141,9 +142,9 @@
  * @param sz		Size of the output buffer.
  *
- * @return True if the character was encoded successfully or false if there
- *	   was not enough space in the output buffer or the character code
- *	   was invalid.
- */
-bool chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz)
+ * @return EOK if the character was encoded successfully, EOVERFLOW if there
+ *	   was not enough space in the output buffer or EINVAL if the character
+ *	   code was invalid.
+ */
+int chr_encode(const wchar_t ch, char *str, size_t *offset, size_t sz)
 {
 	uint32_t cc;		/* Unsigned version of ch. */
@@ -154,8 +155,8 @@
 
 	if (*offset >= sz)
-		return false;
+		return EOVERFLOW;
 
 	if (ch < 0)
-		return false;
+		return EINVAL;
 
 	/* Bit operations should only be done on unsigned numbers. */
@@ -177,10 +178,10 @@
 	} else {
 		/* Codes longer than 21 bits are not supported. */
-		return false;
+		return EINVAL;
 	}
 
 	/* Check for available space in buffer. */
 	if (*offset + cbytes >= sz)
-		return false;
+		return EOVERFLOW;
 
 	/* Encode continuation bytes. */
@@ -196,5 +197,5 @@
 	*offset += (1 + cbytes);
 	
-	return true;
+	return EOK;
 }
 
