Use vs to compile Libiconv library

Source: Internet
Author: User

Reference article: http://blog.csdn.net/ghevinn/article/details/9834119

About the Chinese character encoding problem, this article is very detailed-->HTTP://WWW.TUICOOL.COM/ARTICLES/YIJIQM

UTF-8 encoding is a multi-byte encoding used to solve the international character, and it is one of the most popular Unicode implementations on the Internet. It contains characters that are needed in all countries of the world, are international codes, and are highly versatile. Generally speaking, UTF-8 can be applied to most scenes, especially on the internet, while Chinese encoding is mainly used GBK encoding, so this has GBK and UTF-8 of the mutual conversion requirements. To implement this conversion in the Linux Platform Libiconv Library, see Libiconv official website: http://www.gnu.org/software/libiconv/

But the drawback is that Libiconv developers do not publish the source code and libraries under Windows, so to use the Libiconv library under Windows, you must manually port Libiconv to the Windows platform, the following steps:

1-> to the official website download Libiconv Source package, this article uses is libiconv-1.14.tar.gz

2-> New Libiconv Project

(1) Copy all files under the Lib folder in the downloaded library to this folder

(2) Rename the config.h.in that is baked into the Iconv folder to Config.h

(3) Copy the libcharset/lib/localcharset.c files in the library to this folder

(4) Rename the Iconv.h.in file under the Include folder in the library to iconv.h placed under the Iconv folder

3, add existing items in the project, add Iconv.c, localcharset.c to the project.

4, Project Properties->c/c++–> Additional include directory: $ (ProjectDir);

5. Project Properties: Static library (. lib), configuration type, general

6. Modify the bug in the file

(1) Iconv.h:

1). Remove all @ symbols (14)
2). Modify 25 lines: extern dll_variable int _libiconv_version;

for extern/*dll_variable*/int _libiconv_version;
3). Modify 83 lines: extern size_t iconv (iconv_t CD, Iconv_const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytes left);

for extern size_t Iconv (iconv_t CD, const char* * inbuf, size_t *inbytesleft, char* * outbuf, size_t *outbytesleft);

(2) Localcharset.c:

Comment out 76 lines: # include "Configmake.h"

468 Line: sprintf change to sprintf_s, parameters also to modify, specifically how to change, see the code at a Glance know-->sprintf_s (BUF, 2 + 1, "cp%u", GETACP ());

7: Build the solution, you may report several warnings.

If you think the above process is troublesome, there are ready-made VS2013 works, can be directly compiled:http://download.csdn.net/detail/tangxin19930330/9556870

Use vs to compile Libiconv library

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.