diff --git a/src/core/piinit.cpp b/src/core/piinit.cpp index 7063eba3..59f15fc6 100644 --- a/src/core/piinit.cpp +++ b/src/core/piinit.cpp @@ -85,7 +85,9 @@ void android_thread_exit_handler(int sig) { PIInit::PIInit() { PISystemInfo * sinfo = PISystemInfo::instance(); sinfo->execDateTime = PIDateTime::current(); - file_charset = 0; + file_charset = new char[1024]; + memset(file_charset, 0, 1024); + strcpy(file_charset, "UTF-8"); #ifndef ANDROID PISignals::setSlot(__sighandler__); PISignals::grabSignals(PISignals::UserDefined1); diff --git a/src/io/piiostring.cpp b/src/io/piiostring.cpp index cda17089..bbea5972 100644 --- a/src/io/piiostring.cpp +++ b/src/io/piiostring.cpp @@ -83,7 +83,7 @@ int PIIOString::write(const void * data, int max_size) { if (!canWrite() || !str) return -1; //piCout << "write" << data; if (pos > str->size_s()) pos = str->size_s(); - PIString rs = PIString((const char *)data); + PIString rs = PIString::fromUTF8((const char *)data); if (rs.size_s() > max_size) rs.resize(max_size); str->insert(pos, rs); pos += rs.size_s(); diff --git a/src/io/piserial.h b/src/io/piserial.h index b3483890..b23add9a 100755 --- a/src/io/piserial.h +++ b/src/io/piserial.h @@ -173,9 +173,10 @@ public: //! \returns \b true if sended bytes count = "size" bool send(const void * data, int size, bool wait = false) {return (write(data, size, wait) == size);} - //! \brief Write to device string "data" and wait for data written if "wait" is \b true. - //! \returns \b true if sended bytes count = size of string - bool send(const PIString & data, bool wait = false) {return (write(data.data(), data.lengthAscii(), wait) == data.size_s());} + /// NOTE: no reason to use this function, use PIString::toUtf8() or PIString::dataAscii(),lengthAscii() instead +// //! \brief Write to device string "data" and wait for data written if "wait" is \b true. +// //! \returns \b true if sended bytes count = size of string +// bool send(const PIString & data, bool wait = false) {return (write(data.data(), data.lengthAscii(), wait) == data.size_s());} //! \brief Write to device byte array "data" and wait for data written if "wait" is \b true. //! \returns \b true if sended bytes count = size of string diff --git a/src/system/piprocess.cpp b/src/system/piprocess.cpp index 3bac4787..f9e5ed71 100755 --- a/src/system/piprocess.cpp +++ b/src/system/piprocess.cpp @@ -88,13 +88,13 @@ int PIProcess::currentPID() { PIStringList PIProcess::currentEnvironment() { - PIStringList l; - int i = 0; - while (environ[i] != 0) { - l << environ[i]; - ++i; - } - return l; + PIStringList l; + int i = 0; + while (environ[i] != 0) { + l << environ[i]; + ++i; + } + return l; }