Skip to main content
Inspiring
August 2, 2018
Question

Umlaut (German special characters) problem in CSEvent

  • August 2, 2018
  • 1 reply
  • 847 views

Hi,

I'm having issues when passing German special characters (umlaut) like ü ö ä Ä Ü Ö ß in my extension

(both from js to C++ and from C++ to js).

Javascript:

Here, I dispatch event

function dispatchSearchEvent(fieldName, fieldVal, eventName) {

    var event = new CSEvent(eventName, 'APPLICATION', 'ILST', extensionName);

    event.data = '<payload>';

    event.data += '<SearchFields>' + fieldName + '</SearchFields>';

    event.data += '<SearchValues>' + fieldVal + '</SearchValues>';

    event.data += '</payload>';

    csInterface.dispatchEvent(event);

}

Here, fieldName  and fieldVal are an array of string values.

VC++ :

Here, I add listener to event and parse data.

static void onSearchClickEvent(const csxs::event::Event* const eventParam, void* const context)

{

ArticleSearchController *controller = (ArticleSearchController *) context;

if (controller)

{

AppContext appContext(gArticleSearchPlugin->GetPluginRef());

controller->ParseData(eventParam->data);

}

}

void ArticleSearchController::ParseData(const char* eventData)

{

std::string FieldName_str = getTagContents(eventData, FIELD_NAME_TAG);

std::string FieldValue_str = getTagContents(eventData, FIELD_VALUE_TAG);

}

It is passed as incorrect values. For e.g, "Ü" is passed as "Ü".

Currently, as a workaround, I write that data to a text file and read it from there. This solves my problem.

But i want to know if there is any encoding available to directly pass umlaut characters.

Appreciate your help. Thank you

This topic has been closed for replies.

1 reply

Trevor:
Legend
August 2, 2018

As a slightly more convenient work around you can try Repair utf-8 strings that contain iso-8599 encoded utf-8 characters · GitHub without saving as a temp file. 

Inspiring
August 2, 2018

Thank you Trevor. Will try. I just want to confirm if this list includes all the umlaut characters.