commit 27d3b17ddb10cf4ab8f0ccc09a04a0878d9ae6cb
Author: Stavros Sachtouris <saxtouri@admin.grnet.gr>
Date:   Wed Feb 26 17:10:58 2014 +0200

    Fix copyright (recent file changes)

diff --git a/kamaki/cli/commands/__init__.py b/kamaki/cli/commands/__init__.py
index ed22039..d0b6a65 100644
--- a/kamaki/cli/commands/__init__.py
+++ b/kamaki/cli/commands/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2013 GRNET S.A. All rights reserved.
+# Copyright 2011-2014 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
diff --git a/kamaki/cli/commands/pithos.py b/kamaki/cli/commands/pithos.py
index 7b41b4f..6bc3224 100644
--- a/kamaki/cli/commands/pithos.py
+++ b/kamaki/cli/commands/pithos.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2013 GRNET S.A. All rights reserved.
+# Copyright 2011-2014 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
diff --git a/kamaki/cli/config/__init__.py b/kamaki/cli/config/__init__.py
index a03c7a3..f13f754 100644
--- a/kamaki/cli/config/__init__.py
+++ b/kamaki/cli/config/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2013 GRNET S.A. All rights reserved.
+# Copyright 2011-2014 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
diff --git a/kamaki/cli/utils/__init__.py b/kamaki/cli/utils/__init__.py
index 56269f4..7909302 100644
--- a/kamaki/cli/utils/__init__.py
+++ b/kamaki/cli/utils/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2011-2013 GRNET S.A. All rights reserved.
+# Copyright 2011-2014 GRNET S.A. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or
 # without modification, are permitted provided that the following
@@ -35,11 +35,15 @@ from sys import stdout, stdin
 from re import compile as regex_compile
 from os import walk, path
 from json import dumps
+from kamaki.cli.logger import get_logger
+from locale import getpreferredencoding
 
 from kamaki.cli.errors import raiseCLIError
 
 
 INDENT_TAB = 4
+log = get_logger(__name__)
+pref_enc = getpreferredencoding()
 
 
 suggest = dict(ansicolors=dict(
@@ -56,6 +60,45 @@ except ImportError:
     suggest['ansicolors']['active'] = True
 
 
+def _encode_nicely(somestr, encoding, replacement='?'):
+    """Encode somestr as 'encoding', but don't raise errors (replace with ?)
+        This method is slow. Us it only for grace.
+        :param encoding: (str) encode every character in this encoding
+        :param replacement: (char) replace each char raising encode-decode errs
+    """
+    newstr, err_counter = '', 0
+    for c in somestr:
+        try:
+            newc = c.encode(encoding)
+            newstr = '%s%s' % (newstr, newc)
+        except UnicodeError:
+            newstr = '%s%s' % (newstr, replacement)
+            err_counter += 1
+    if err_counter:
+        log.debug('\t%s character%s failed to be encoded as %s' % (
+            err_counter, 's' if err_counter > 1 else '', encoding))
+    return newstr
+
+
+def DontRaiseUnicodeError(foo):
+    def wrap(self, *args, **kwargs):
+        try:
+            s = kwargs.pop('s')
+        except KeyError:
+            try:
+                s = args[0]
+            except IndexError:
+                return foo(self, *args, **kwargs)
+            args = args[1:]
+        try:
+            s = s.encode(pref_enc)
+        except UnicodeError as ue:
+            log.debug('Encoding(%s): %s' % (pref_enc, ue))
+            s = _encode_nicely(s, pref_enc, replacement='?')
+        return foo(self, s, *args, **kwargs)
+    return wrap
+
+
 def suggest_missing(miss=None, exclude=[]):
     global suggest
     sgs = dict(suggest)
@@ -424,7 +467,7 @@ def filter_dicts_by_dict(
     :param exact_match: (bool) if false, check if the filter value is part of
         the actual value
 
-    :param case_sensitive: (bool) revers to values only (not keys)
+    :param case_sensitive: (bool) refers to values only (not keys)
 
     :returns: (list) only the dicts that match all filters
     """
