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

  • Home
  • SEARCH
  • 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 6212031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:26:26+00:00 2026-05-24T06:26:26+00:00

I want to store a Japanese text in a string and write it to

  • 0

I want to store a Japanese text in a string and write it to a file. I am totally unfamiliar with encoding and there are a lot of data types like wchar_t and wstring in C++ which appear confusing to me. How can I do this?

I am trying to create a well-formed XML file with some CDATA content being Japanese.

  • 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-24T06:26:28+00:00Added an answer on May 24, 2026 at 6:26 am

    Ignore the complexities and pitfalls of wide strings altogether; and ensure that the data you are dealing with is encoded using UTF-8 instead.

    In C++, UTF-8-strings can be handled just like extended ASCII strings; unless you happen to actually manipulating them (chopping them up, counting characters, things like that).

    If all you care about is gathering, storing and displaying the strings, it is quite simply laughably trivial.

    (Without more information about the environment in which you are working, it’s impossible to tell you exactly how you would go about ensuring UTF-8-ness; but that’s really beyond the scope of this question.)

    Edit:

    In response to comments regarding what you are planning to do (writing an XML file):

    When working with XML in particular; it’s very, very simple:

    Never Don’t Use UTF-8!, or “N’DUUH!” for short.

    In XML, the ASCII-balance will in practice always be such that UTF-8 is the most space-efficient encoding system.

    (To wit, if each Japanese character in the document can be matched by an ASCII character, UTF-8 is exactly as efficient as UTF-16, in terms of space. XML element names are traditionally needlessly verbose, and Japanese sentences are notoriously compact; and when adding in indentation, Japanese text will almost always be matched by ASCII in abundance.)

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

Sidebar

Related Questions

I want store data from an html page to a text file using javascript
I want to store the data returned by $_SERVER[REMOTE_ADDR] in PHP into a DB
I want to store a very large amount of vector data on a server
I want to store a string in memory and read it later: $$->desc.constant->base.id =
i Just in windowsphone . i want store data as record in WP .
I want to store history data in a sqlite db. a max of 20
I want to store day bay day trading stock data. These data are composite
I want to store a string in a cookie of the form 1.236|2.48|3.574|4.094| Each
I want to take a string and store it in a MYSQL db. This
I want to store some test data for a FlexUnit test in small XML

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.