Advertisement
Guest User

Untitled

a guest
Nov 25th, 2011
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <iostream>
  2. #include <langinfo.h>
  3. #include <iconv.h>
  4.  
  5. char buf[100] ="\376\377\060\336\060\374\060\331\060\351\060\271\060\250\060\363\060\277\060\374\060\306\060\244\060\341\060\363\060\310\0\0\0\0";
  6. char buf2[100];
  7. //char buf3[100] = "\376\377\060\336";
  8. char buf3[100] = "\377\376\336\060";
  9. char buf4[100];
  10. int main(int argc, char** argv)
  11. {
  12. static const char empty_codeset[] = "";
  13. const char *codeset = empty_codeset;
  14. // Application
  15. iconv_t dum1 = iconv_open("UTF-8", "UTF-16");
  16.  
  17. char* p2, *p;
  18. size_t a = 0, b = 0;
  19. iconv_t conv = iconv_open("UTF-8", "UTF-16");
  20. p= buf, p2 = buf2;
  21. a = 32, b = 100;
  22. iconv(conv, &p, &a, &p2, &b);
  23.  
  24.  
  25. std::cout << buf2 << std::endl;
  26.  
  27. size_t c = 32, d = 100;
  28. p = buf3; p2 = buf4;
  29. iconv(dum1, &p, &c, &p2, &d);
  30.  
  31. std::cout << buf4 << std::endl;
  32.  
  33. return 0;
  34. }
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement