Make safe_encode func case-insensitive

Function 'safe_encode ' in 'encodeutils' module treats 'UTF-8' and 'utf-8'
encodings as different.
But it should understand different aliases, that have different text cases.
It allows us avoid redundant coding/decoding.
Also added unittests.

Change-Id: I4c446952fc904c1231cccbda1cd4d2a4cce5c55f
Closes-Bug: #1342050
Merge "Make safe_encode func case-insensitive"