Unicode string normalization in C/C++

前端 未结 5 1694

Am wondering how to normalize strings (containing utf-8/utf-16) in C/C++. In .NET there is a function String.Normalize .

I used UTF8-CPP in the past but it does not prov

5条回答
  •  花落未央
    2021-02-13 04:07

    For Windows, there is the NormalizeString() function (unfortunately for Vista and later only - as far as I see on MSDN):

    http://msdn.microsoft.com/en-us/library/windows/desktop/dd319093%28v=vs.85%29.aspx

    It's the simplest way to go that I have found so far. I guess it's quite lightweight too.

    int NormalizeString(
        _In_      NORM_FORM NormForm,
        _In_      LPCWSTR   lpSrcString,
        _In_      int       cwSrcLength,
        _Out_opt_ LPWSTR    lpDstString,
        _In_      int       cwDstLength
    );
    

提交回复
热议问题