diff --git a/lib/anytone_codeplug.cc b/lib/anytone_codeplug.cc index 46a8f164..64364b1f 100644 --- a/lib/anytone_codeplug.cc +++ b/lib/anytone_codeplug.cc @@ -565,11 +565,11 @@ AnytoneCodeplug::ChannelElement::clearEncryptionKeyIndex() { QString AnytoneCodeplug::ChannelElement::name() const { - return readASCII(0x0023, 16, 0x00); + return readGBK(0x0023, 16, 0x00); } void AnytoneCodeplug::ChannelElement::setName(const QString &name) { - writeASCII(0x0023, name, 16, 0x00); + writeGBK(0x0023, name, 16, 0x00); } diff --git a/lib/codeplug.cc b/lib/codeplug.cc index be94c0c1..52463bc7 100644 --- a/lib/codeplug.cc +++ b/lib/codeplug.cc @@ -1,6 +1,7 @@ #include "codeplug.hh" #include "config.hh" #include +#include #include "logger.hh" #include "roamingchannel.hh" @@ -579,6 +580,26 @@ Codeplug::Element::writeUnicode(unsigned offset, const QString &txt, unsigned ma } } +QString +Codeplug::Element::readGBK(unsigned offset, unsigned maxlen, uint8_t eos) const { + QByteArray txt; + uint8_t *ptr = (uint8_t *)(_data+offset); + for (unsigned i=0; (itoUnicode(txt); +} +void +Codeplug::Element::writeGBK(unsigned offset, const QString &txt, unsigned maxlen, uint8_t eos) { + QByteArray enc = QTextCodec::codecForName("GBK")->fromUnicode(txt.left(maxlen)); + uint8_t *ptr = (uint8_t *)(_data+offset); + for (unsigned i=0; i