Skip to content
  • Junio C Hamano's avatar
    reencode_string(): introduce and use same_encoding() · 0e18bcd5
    Junio C Hamano authored
    
    
    Callers of reencode_string() that re-encodes a string from one
    encoding to another all used ad-hoc way to bypass the case where the
    input and the output encodings are the same.  Some did strcmp(),
    some did strcasecmp(), yet some others when converting to UTF-8 used
    is_encoding_utf8().
    
    Introduce same_encoding() helper function to make these callers use
    the same logic.  Notably, is_encoding_utf8() has a work-around for
    common misconfiguration to use "utf8" to name UTF-8 encoding, which
    does not match "UTF-8" hence strcasecmp() would not consider the
    same.  Make use of it in this helper function.
    
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    0e18bcd5