/* Given an ucsA string, this function returns the size (in bytes) this string would have occupied if it was encoded in utf-8.  */
enum CRStatus cr_utils_ucs1_str_len_as_utf8(const guchar *a_in_start, const guchar *a_in_end, gulong *a_len)
/* Given an ucsA string, this function returns the size (in bytes) this string would have occupied if it was encoded in utf-8.  */
enum CRStatus cr_utils_ucs1_str_len_as_utf8(const guchar *a_in_start, const guchar *a_in_end, gulong *a_len)
{
        gint len = 0;
        guchar *char_ptr = NULL;
        g_return_val_if_fail (a_in_start && a_in_end && a_len,
                              CR_BAD_PARAM_ERROR);
        for (char_ptr = (guchar *) a_in_start;
             char_ptr <= a_in_end; char_ptr++) {
                if (*char_ptr <= 0x7F) {
                        len += 1;
                } else {
                        len += 2;
                }
        }
        *a_len = len;
        return CR_OK;
}