mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-09-01 09:51:22 +02:00
git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@27 e54a6e83-5905-42d5-8d5c-058d10e6a962
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
/*
|
|
* $Header: /cvs/tuxbox/apps/tuxbox/neutrino/src/driver/encoding.cpp,v 1.2 2003/09/27 11:48:09 thegoodguy Exp $
|
|
*
|
|
* conversion of character encodings - d-box2 linux project
|
|
*
|
|
* (C) 2003 by thegoodguy <thegoodguy@berlios.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
*/
|
|
|
|
#include <driver/encoding.h>
|
|
|
|
std::string Latin1_to_UTF8(const std::string & s)
|
|
{
|
|
std::string r;
|
|
|
|
for (std::string::const_iterator it = s.begin(); it != s.end(); it++)
|
|
{
|
|
unsigned char c = *it;
|
|
if (c < 0x80)
|
|
r += c;
|
|
else
|
|
{
|
|
unsigned char d = 0xc0 | (c >> 6);
|
|
r += d;
|
|
d = 0x80 | (c & 0x3f);
|
|
r += d;
|
|
}
|
|
}
|
|
return r;
|
|
}
|