arabica/examples/Utils/transcode.cpp

30 lines
659 B
C++
Raw Normal View History

2003-09-02 13:23:52 +02:00
// transcode.cpp
//
#include <iostream>
#include <Utils/convert_adaptor.h>
#include <Utils/utf8iso88591codecvt.h>
#include <Utils/iso88591utf8codecvt.h>
#include <Utils/rot13codecvt.h>
2003-09-10 13:01:47 +02:00
#include <Utils/base64codecvt.h>
2003-09-02 13:23:52 +02:00
#include <Utils/utf8ucs2codecvt.h>
#include <Utils/utf16utf8codecvt.h>
#include <Utils/utf16beucs2codecvt.h>
#include <Utils/utf16leucs2codecvt.h>
int main(int argc, const char* argv[])
{
2003-09-10 13:01:47 +02:00
iconvert_adaptor<char> ia(std::cin);
oconvert_adaptor<char> oa(std::cout);
2003-09-02 13:23:52 +02:00
2003-09-10 13:01:47 +02:00
ia.imbue(std::locale(ia.getloc(), new base64codecvt()));
2003-09-02 13:23:52 +02:00
while(ia)
{
2003-09-10 13:01:47 +02:00
oa << static_cast<char>(ia.get());
2003-09-02 13:23:52 +02:00
oa.flush();
} // while
return 0;
} // main