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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:25:01+00:00 2026-06-18T01:25:01+00:00

I am having a problem with some characters in 2 strings that my program

  • 0

I am having a problem with some characters in 2 strings that my program uses.

String #1 is filled using VB code that gets data from a 3rd party application.
String #2 gets similar data from the same 3rd party application, but it gets it with a C++ dll and sends it to VB.

The data has some weird symbols in it.

I don’t know a whole lot about encoding and different character sets, but I’ll try to explain it the best I can.

I will use “Т” as my example character.

“Т” (note this isnt a normal capital t) it is unicode decimal value 1058
http://www.unicodemap.org/details/0x0422/index.html

When this character appears in String #1 during runtime it appears as “?”, which I believe is just what VB6 does to show some unicode characters. When I use AscW on the character it returns the correct value of 1058.

When I output the string to a text file, it appears as “?”.

The same character in String #2 from the C++ DLL appears as 2 characters “Т”

When I output that string to a text file, the character appears properly as “Т”.

I was only outputting things to text files for testing purposes. I only need the 2 strings to be encoded / appear the same during run time.

Any idea whats going on here? Any way for me to get weird characters to appear the same in both strings?

Thanks

edit: also the C++ dll is in multi character set and sends the data in a BSTR string

CODE IN C++ DLL

allChat is a CString

BSTR Message;
int len = allChat.GetLength();
Message = SysAllocStringByteLen ((LPCTSTR)allChat,len+1);

Message is returned to the VB app.. and nothing happens to the string after that.

String #1 is just a regular VB string

  • 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-18T01:25:03+00:00Added an answer on June 18, 2026 at 1:25 am

    From the way Cyrillic “T” becomes “Т”, you get your string as a UTF8 encoded string (I verified that with Notepad++ by switching encodings). You need to convert it to Unicode before sending it to your VB app. Note that your VB app needs to be Unicode, not ASCII.

    You can convert UTF8 to std::wstring with this function:

    std::wstring utf8to16( const char* src )
    {
        vector<wchar_t> buffer;
        buffer.resize(MultiByteToWideChar(CP_UTF8, 0, src, -1, 0, 0));
        MultiByteToWideChar(CP_UTF8, 0, src, -1, &buffer[0], buffer.size());
        return &buffer[0];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having a problem with some code that used to work in PHP 4.X
I am having some problem with writing a function to extract strings from a
I'm having some trouble with a string that comes from a webpage having foreign
I am having some problem with jsonp and jquery. This is my code -
I've having this problem with some JavaScript code. I've simplified it in the error
I'm having a problem with some code I've written. I've had to anonymize it,
I have a program that reads arbitrary data from a file system and outputs
I'm having troubles with unicode characters in my Rails app. The problem is that
I'm having a problem with some characters like 'í' or 'ñ' working in a
I'm having a problem when trying to apply a regular expression to some strings

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.