Skip to content

Are A or W APIs recommended? #3307

@aliceeatsacarrot

Description

@aliceeatsacarrot

Hello,

I am excited about the UTF-8 support. The page mentions "Until recently, Windows has emphasized "Unicode" -W variants over -A APIs." Does this mean the ANSI functions are now preferred over the WCHAR ones? For a new application wanting to support multiple languages, which of calling the UTF-8 APIs or the UTF-16LE ones is recommended? Would it be possible to update the page with the information?

Thank you!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

added
doc-enhancementfeedback is about suggested additions/improvements to the article, but customer is not blocked
on Sep 17, 2021
added a commit that references this issue on Feb 15, 2023
Paul-Dempsey

Paul-Dempsey commented on Mar 20, 2023

@Paul-Dempsey
Contributor

While UTF-8 now works, and could be convenient for x-platform code, WIndows is still at its base a 16-bit Unicode system and using A APIs always involves a runtime conversion (small but nonzero performance impact). So, depends on your codebase and specific app requirements. UTF-8 is still relatively new, and there are likely interesting edge cases and potential interop issues that could be problematic. (e.g. low-level file system edge cases with nonconforming Unicode sequences.)

jaigak

jaigak commented on Oct 15, 2023

@jaigak
Contributor

Another thing to note is the A variants are not necessarily UTF-8 - they are whatever code page set on the system or manifested for your application. Converting UTF-8 to UTF-16 yourself and then calling the W variants is more reliable if you are not aware of the settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Pri2design/techdoc-enhancementfeedback is about suggested additions/improvements to the article, but customer is not blockeduwp/prod

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @Karl-Bridge-Microsoft@PRMerger5@Paul-Dempsey@PRMerger7@jaigak

      Issue actions

        Are A or W APIs recommended? · Issue #3307 · MicrosoftDocs/windows-dev-docs