简体   繁体   中英

Compare two language strings

We are working on a remote manmagment software. We require to compare the data we get from the remote system. We are using C++ and WMI to get data from remote system. WHen processing the data we may need to compare certain words (against constant words we have) from the data collected from remote system. When the host and target systems are in English language, we have no issues in compare the strings.

But when the remote computer returns data other than english, our comparision is failed. We thought of implementing localization and keep all possible language strings with us, . And if, one of the strings in our list maches, we can proceed. But it is very tedious process.

Is there any way to compare strings from two differnt languages in C++ or WMI...?

Any APIs..? OR Workarounds...?

Please help!

There are c# facilities for comparing strings in a locale, or culture-specific way, see this which gives an example of a comparison between two german strings treating the different representations of "ss" and the essettz character 'ß'as equivalent.

To do this you need to have knowledge of the language of the host computer, it's debatable if you should treat ss and 'ß'as equal if you are not working in German.

But I'm not clear to whether you have this kind of problem. Are you in fact hoping to actually translate the text you receive? So on you machine you have a list of strings:

RED
GREEN
WHITE

and you might receive from the host RED or ROUGE or ROT. In which case I don't really see you have much option but to keep a translation table.

You should use std::locale and its various features ( operator() ). I suppose you also want to use std::wstring instead of usual std::string to support UTF-like characters.

I think you're looking for Windows Management Instrumentation: International Support Overview . The need for localization, and the resulting need for cross-locale support has been noted before.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM