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 8507503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:53:26+00:00 2026-06-11T02:53:26+00:00

I’d like to convert my visual studio project from MBCS to Unicode CS. But

  • 0

I’d like to convert my visual studio project from MBCS to Unicode CS. But I have like 900 const char arrays in my source code, is there an automatic way to do it? it is very a lot to do line by line.
In doing I’m referring to adding _T(“asd”) to “asd”.

  • 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-06-11T02:53:28+00:00Added an answer on June 11, 2026 at 2:53 am

    There’s no way around this.

    A string literal is interpreted/encoded as “char *” unless you use L to tell the compiler to always encode it as Unicode (WCHAR/wide string), or you use the _T macros to have it encoded depending on whether the “Character Set” is set to ANSI/MBCS or Unicode..

    You might be tempted to change the encoding of your source files with “File | Advanced Save Options” to Unicode…thinking that this will change how your string literals are encoded…but no…they will still be treated as narrow strings.

    Some links that may help understand the options.

    • http://www.i18nguy.com/unicode/c-unicode.html

    • Visual C++: Migrating traditional C and C++ string code to a Unicode world

    • http://www.nubaria.com/en/blog/?p=289

    • http://www.codeproject.com/Articles/2995/The-Complete-Guide-to-C-Strings-Part-I-Win32-Chara


    Your best bet is to write a “macro” in Visual Studio that you can run and it will go through the set of source code files containing your string literals and adds the _T( ) or L prefix to those strings.

    How sophisticated you make the macro is up to you…but it should be possible to get the macro to pattern match a string, and then asks you for confirmation as to whether to prefix/wrap the string literal (with L or _T())….because you don’t want to convert all the strings in your source…because some will need to stay as narrow strings.


    Another option is you could use the Find dialog to find strings, and then visually see if they need modifying and manually do the modification.

    • Searching For String Literals

    And finally, you might be able to leverage a “translation tool” that is following the “in-place localized replacement of strings in source files and then recompile” localization technique (as opposed to the “extract strings out to Resources” technique…which is the more common one). I know there are tools like that, that can extract strings from source files…build a table/database of those strings…which then get translated, and then re-inserted….(in fact I wrote something to do that in the past). Maybe you could find a tool that does that…but modify it slightly to insert the L prefix when inserting the strings back in.

    In fact, if your taking the trouble to make your application Unicode…then I would imagine at some point you will be intending to support different localizations of your application….so what you could do is move all your strings to Resources…and Resources hold them as Unicode…you’d have to modify you code to get the strings loaded from resources, etc.

    • http://www.lingobit.com/extractor/cplusplus_extract_hardcoded_string.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a French site that I want to parse, but am running into
This could be a duplicate question, but I have no idea what search terms
I have a text area in my form which accepts all possible characters from
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have two tables with like below codes: Table: Accounts id | username |
I have a view passing on information from a database: def serve_article(request, id): served_article
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.