Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6348165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:22:10+00:00 2026-05-24T21:22:10+00:00

Is it specified what will happen if I imbue basic_stream<char> with locale with codecvt_utf16<char>

  • 0

Is it specified what will happen if I imbue basic_stream<char> with locale with codecvt_utf16<char> facet?

Basically, I use typedef wchar_t tchar; and typedef char tchar; to alter interfaces for (what I call) Unicode and non-Unicode builds of my library. I want to make the source simpler by always imbuing my file streams with locale with codecvt_utf16<tchar> facet. Will this work anyhow at all?

(I would not mind if the file read by such imbued fstream would have to contain either only ASCII or only code points representable in current global locale.)

EDIT:

Given that codecvt_utf16<char> seems to be unspecified behaviour, what about imbuing basic_stream with codecvt_utf16<wchar_t>? Is this behaviour specified?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:22:11+00:00Added an answer on May 24, 2026 at 9:22 pm

    Per C++0x, codecvt_utf*<> can be instantiated with wide characters only. What happens if you use char is not specified, the only way to know is to try.

    Bear in mind that codecvt_utf16 converts to/from external UTF-16 representation. That is, your file is supposed to be encoded in UTF-16. You might want to consider using UTF-8 instead.

    As a side note, it is a mystery to me why would anyone want anything non-Unicode these days. Do people enjoy using restricted character sets or what?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to construct a transact sql script that will stop specified people from
I'm building a C# application that will monitor a specified directory for changes and
I'm trying to create an application that will let me execute a method specified
My Application has registered one receiver in Manifest file. What will happen to the
What will happen if I declare DB null field as not null in Mapping
Flash Player 10 specifies: Redirects to policy files outside the originally requested domain will
If a connection string specifies Trusted_Connection=true with SQL Server authentication mode, will performance of
I have a certain service where specific functions will take longer to call than
Given that the tasks in a specific sprint will not divide perfectly into the
This is a very specific question which will probably earn me the tumbleweed badge,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.