Jump to content
  • Advertisement
Sign in to follow this  
jollyjeffers

[C++] Checking unicode compliance of a codebase

This topic is 4844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Afternoon all, I've been giving some thought lately towards localization in our codebase. Some nice new publishing possibilities and some non-too-forward-thinking design choices have necessitated that I migrate over to unicode. Not a huge problem as the game is about 99% data-driven ([grin]) so I don't have to go through correcting too many string literals and random character constants in the code. I hope. Anyway, I've done my research into what I need to change (and what it changes to) and I don't see many problems there. My question - Can I verify using tools/compilers etc.. whether I have migrated completely/successfully? Basically, if I go through each/every file and get rid of all char or similar and then run a script/test/program on it and it says "Yay! you rock you're no longer using any non-unicode strings" or "You suck, you haven't changed ___ in the file ___ yet.". Anyone heard of such a tool? If it helps, I'm developing on a Windows XP and Visual Studio 2030 platform. Cheers, Jack

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by jollyjeffers
If it helps, I'm developing on a Windows XP and Visual Studio 2030 platform.

Wow. What kind of MSDN subscription is that, and where can I get it? [lol]

Quote:
My question - Can I verify using tools/compilers etc.. whether I have migrated completely/successfully?

Try a static code analysis tool like FxCop (if this is Managed C++ or the like). I'm not very familiar with other static code analysis tools for non-managed C++, but a Google search on things like "static code analysis tool", "style compliance verifier", and so on will hopefully yield something that you're looking for.

Share this post


Link to post
Share on other sites
Thanks for the quick reply!

Quote:
Original post by kSquared
Quote:
Original post by jollyjeffers
If it helps, I'm developing on a Windows XP and Visual Studio 2030 platform.

Wow. What kind of MSDN subscription is that, and where can I get it? [lol]

[lol] It's a special subscription for special people like me who can't type properly [smile]

You wouldn't want a copy anyway, it's still in pre-pre-pre-early-prototype-alpha. Due for a public beta in around 23-24 years time though...

Quote:
Original post by kSquared
a Google search on things like "static code analysis tool", "style compliance verifier", and so on will hopefully yield something that you're looking for.

I'll try that search phrase in a minute, thanks for the suggestion. My previous attempts at googling for a tool came up with 100's of pages telling me what to look for and check, but no automated magic tool that'd do the checking for me.

Jack

Share this post


Link to post
Share on other sites
Um, in a strict C++ environment, complete migration to Unicode may be impossible. For example, several of the standard C++ library classes do not provide Unicode equivalents to narrow character functions. The notable example being the fstream::open() which only takes a const char *.

Share this post


Link to post
Share on other sites
The only tool I know off hand about was something tossed together in-house at my last workplace that took some standard C++ text-highlighting code out of a text-editor and made it spit out a report for string literals and some choice types [more than just the char * variety; dates, times, timezone, monetary, and OS interaction functions often will need inspected for internationalization issues as well].

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Here's a link that will probably be helpful:

http://www.codeproject.com/vcpp/stl/upgradingstlappstounicode.asp

Share this post


Link to post
Share on other sites
Apologies for the slow reply - not been online much lately [sad]

Thanks for the comments - appreciated!

I'm only really interested in unicode so as to allow some internationalization of the various data files that are loaded and presented to the user (I suppose that is fairly common) - there are "deep" internal parts using char* that I'm content with leaving alone as they really don't matter too much for localization.

Quote:
The only tool I know off hand about was something tossed together in-house at my last workplace that took some standard C++ text-highlighting code out of a text-editor and made it spit out a report

I suppose my current process is somewhat similar - for each file I've been doing a find/mark for any std::string, char, char* etc... changing those to appropriate wide variants causes a mountain of compile errors that I can use to find the other non-unicode parts [grin]

Quote:
Here's a link that will probably be helpful:

http://www.codeproject.com/vcpp/stl/upgradingstlappstounicode.asp

That's a brilliant article - thanks for the link. Sadly it points out a few places that are going to **really** hurt me. Our code does a huge amount of loading from files (not too bad) and a reasonable amount of writing to files (painful).


Cheers,
Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!