starmessage/libSoftMeter

From a Delphi application, Greek text does not pass OK to Google Analytics

starmessage opened this issue · 3 comments

When using SoftMeter to get application analytics for software compiled with Delphi, the Greek texts in the sendPageview(), sendEvent(), sendScreenview() does not appear correctly in the Google Analytics reporting.

From the C++ console demo, Greek texts pass ok to Google Analytics.
So, the problem must be related to the Delphi code, probably to the DLL linking and the PAnsiChar type that is used as a type for the string parameters in the demo Delphi program.

First, make sure your source files are in UTF-8 encoding.
Right-click on your source code in the Delphi IDE, and select File Format. Then choose UTF-8.

In Delphi XE5, go to project options, code page and enter 65001.

This fixes the problem and Greek text passes Ok to Google Analytics.
image

Delphi 7 is not unicode and the above solution cannot be applied.
In Delphi 7, you can simple pass your text via the function "Utf8Encode" which is an "out-of-the-box" function in the Delphi RTL.

For example a call to sendPageView would be:
sendPageview(PAnsiChar(UTF8Encode('a page path')), PAnsiChar(UTF8Encode('a page title')) );