/* PIP - Platform Independent Primitives Text codings coder, based on "iconv" Ivan Pelipenko peri4ko@yandex.ru This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ #ifndef PIP_FREERTOS #include "picodec.h" PIStringList PICodec::availableCodecs() { exec("/usr/bin/iconv", "-l"); waitForFinish(); PIString str(readOutput()); str.cutLeft(str.find("\n ")); str.replaceAll("\n", ""); return str.split("//"); } PIByteArray PICodec::exec_iconv(const PIString & from, const PIString & to, const PIByteArray & str) { tf.openTemporary(PIIODevice::ReadWrite); tf.clear(); tf << str; tf.close(); exec("/usr/bin/iconv", PIStringList() << ("-f=" + from) << ("-t=" + to) << tf.path()); waitForFinish(); return readOutput(); } #endif // PIP_FREERTOS