Romeo » 17 дек 2015, 10:17
Сионист писал(а): А что надо передать в четвёртый параметр WideCharToMultiByte в случае преобразования одной суррогатной пары? Количество символов, то есть 1, или количество wchar_t, то есть 2?
MSND писал(а):
cchWideChar [in]
Size, in characters, of the string indicated by lpWideCharStr. Alternatively, this parameter can be set to -1 if the string is null-terminated. If cchWideChar is set to 0, the function fails.
If this parameter is -1, the function processes the entire input string, including the terminating null character. Therefore, the resulting character string has a terminating null character, and the length returned by the function includes this character.
If this parameter is set to a positive integer, the function processes exactly the specified number of characters. If the provided size does not include a terminating null character, the resulting character string is not null-terminated, and the returned length does not include this character.
Сионист писал(а):Кстати, в WPARAM 8 байт.
Ты уверен? По поводу этого ничего не могу сказать. Нужно тестить.
Сионист писал(а):Так мало ли как он поддерживается. Может приходят два сообщения подряд с половинками суррогатной пары?
Если бы это было так, то в спецификации было бы об этом сказано. Microsoft можно ругать сколько угодно и за что угодно, но документацию к API они содержат всегда в up-to-date состоянии, так как они получаются за это деньги. Привыкни верить MSDN, а не задаваться бесполезными вопросами "а что если...".
[quote="Сионист"] А что надо передать в четвёртый параметр WideCharToMultiByte в случае преобразования одной суррогатной пары? Количество символов, то есть 1, или количество wchar_t, то есть 2?[/quote]
[quote="MSND"]
cchWideChar [in]
Size, in characters, of the string indicated by lpWideCharStr. Alternatively, this parameter can be set to -1 if the string is null-terminated. If cchWideChar is set to 0, the function fails.
If this parameter is -1, the function processes the entire input string, including the terminating null character. Therefore, the resulting character string has a terminating null character, and the length returned by the function includes this character.
If this parameter is set to a positive integer, the function processes exactly the specified number of characters. If the provided size does not include a terminating null character, the resulting character string is not null-terminated, and the returned length does not include this character.
[/quote]
[quote="Сионист"]Кстати, в WPARAM 8 байт.[/quote]
Ты уверен? По поводу этого ничего не могу сказать. Нужно тестить.
[quote="Сионист"]Так мало ли как он поддерживается. Может приходят два сообщения подряд с половинками суррогатной пары?[/quote]
Если бы это было так, то в спецификации было бы об этом сказано. Microsoft можно ругать сколько угодно и за что угодно, но документацию к API они содержат всегда в up-to-date состоянии, так как они получаются за это деньги. Привыкни верить MSDN, а не задаваться бесполезными вопросами "а что если...".