Jump to content
shun

Need Assistance with Transitioning from ANSIString to UnicodeString in C++Builder

Recommended Posts

Environment:

  • C++Builder 5.0.12.34
  • OS: Windows 10 Pro

I am currently in the process of updating our C++Builder project and need to transition from using ANSIString to UnicodeString, as the string type in the RTL has been mapped to UnicodeString in the latest versions.

To ensure a smooth migration, I need to identify all the places where we use:

  • ANSIString or char-based strings.
  • Functions that count characters based on the assumption that 1 character equals 1 byte (such as those working with strlen or similar).
  • Any C-language derived functions (e.g., strcpy, sscanf, fopen) that need to be replaced with their wide-character counterparts (e.g., wcscpy, swscanf, _wfopen).
  • Literal strings that need to be prefixed with L for wide character support.

Could you provide guidance or tools to help identify all the necessary changes to make for this transition?

Share this post


Link to post

Start with the Unicode section of Embarcadero's Migration and Upgrade Center.

 

Note that AnsiString and all of the other things you mentioned still exist. You just need to be aware of how they interact with Unicode strings if you don't want to completely rewrite your code.

  • Like 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×