Skip to content

Wrong parameter used in conversion method "utf16string __cdecl conversions::utf8_to_utf16(const std::string &s)" in source file "asyncrt_utils.cpp" #153

Closed
@CoolMcCool

Description

@CoolMcCool

When using macro "CPPREST_STDLIB_UNICODE_CONVERSIONS" there is an issue while converting from the defined parameter "const std::string &s" to utf16 format.

Could you please change the name from "src" to "s" in line 287?

Current implementation:
`
utf16string __cdecl conversions::utf8_to_utf16(const std::string &s)
{

if defined(CPPREST_STDLIB_UNICODE_CONVERSIONS)

std::wstring_convert<std::codecvt_utf8_utf16<utf16char>, utf16char> conversion;
return conversion.from_bytes(src);

else

...
**Solution:**
utf16string __cdecl conversions::utf8_to_utf16(const std::string &s)
{

if defined(CPPREST_STDLIB_UNICODE_CONVERSIONS)

std::wstring_convert<std::codecvt_utf8_utf16<utf16char>, utf16char> conversion;
return conversion.from_bytes(s);

else

...
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions