Skip to content

[BUG] mbstowcs and wcstombs cannot get correct return value when called in the environment below api 21 #1108

Closed
@Satsukina

Description

@Satsukina

Description

use mbstowcs to convert multibyte to widechar and use wcstombs to convert back. But these two functions' return value are always 0 and convert fail.

example 1:
char *buffer = "1234";
int length = mbstowcs(NULL, buffer, 0);

The return value length is 0, its expected value should be 4.

example 2:
wchar_t *buffer = L"1234";
int length = wcstombs(NULL, buffer, 0);

The return value length is 0, its expected value should be 4.

Environment Details

Not all of these will be relevant to every bug, but please provide as much
information as you can.

  • NDK Version: 20.0.5594570
  • Build system: ndk-build
  • Host OS: Windows
  • ABI: armeabi-v7a, x86
  • NDK API level: 16
  • Device API level: 17

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions