Adapting non-ASCII content
Hello ecap dev,
The modifying adapter sample replacing "the" with "a" works well with newest 3.1 and patched adapter code. Great!
But, the method:
void Adapter:
// this is oversimplified; production code should worry about content
// split by arbitrary chunk boundaries, efficiency, and other things
// another simplification: victim does not belong to replacement
static const std::string victim = "the";
static const std::string replacement = "a";
std::string:
while ((pos = chunk.find(victim, pos)) != std::string::npos)
chunk.
}
only works for sites encoded in ASCII (which is very few these days.) When you try to adapt a site with any other encoding, the replacer will not find any matches.
It is my understanding that std::string is used for 1-byte character based strings, whereas std::wstring should be used for multi-byte character stings.
How would you go about handling this issue, so that the simple adaption would work on all (or at least more) encodings?
thx /Martin
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- eCAP Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Martin for more information if necessary.