Lazarus 1.44 upgrade to 1.6 UTF8 processing has changed.

Source: Internet
Author: User

First of all, it really has to be stressed that since freepascal upgraded to 3.0, the interior of the FPC changed the entire code processing from ansistring to UTF8 encoding (RTL with default codepage UTF-8).

The actual application will find that if the wndows API is used such as

function var poutbuflen:ulong): DWORD; stdcall;
{$EXTERNALSYM getadaptersinfo};
adapter_info-per-Adapter information. All IP addresses is stored as//Strings//Pip_adapter_info=^ip_adapter_info; {$EXTERNALSYM Pip_adapter_info}_ip_adapter_info=RecordNext:pip_adapter_info;    Comboindex:dword; AdapterName:Array[0.. Max_adapter_name_length +3] ofChar; Description:Array[0.. Max_adapter_description_length +3] ofChar;    Addresslength:uint; Address:Array[0.. Max_adapter_address_length-1] ofBYTE;    Index:dword;    Type_: UINT;    Dhcpenabled:uint;    currentipaddress:pip_addr_string;    ipaddresslist:ip_addr_string;    gatewaylist:ip_addr_string;    dhcpserver:ip_addr_string;    Havewins:bool;    primarywinsserver:ip_addr_string;    secondarywinsserver:ip_addr_string;    leaseobtained:time_t;  leaseexpires:time_t; End; {$EXTERNALSYM _ip_adapter_info}Ip_adapter_info=_ip_adapter_info; {$EXTERNALSYM Ip_adapter_info}Tipadapterinfo=Ip_adapter_info; Pipadapterinfo= Pip_adapter_info;

Description save is a regular string array, if it is ansistring easy to handle, containing characters other than ASCII, using Utf8encode (), can also be very good support, 1.6 version after the default utf8=ansistring (cp_ UTF8), the result is that for the non-identified string, the use of Utf8encode is invalidated, then AnsiToUtf8 () How, the same has no effect.

View LazUTF8 unit, a few more functions including WinCPToUTF8 (), yes it, processing WINAPI interface string, the display is normal.

Lazarus Unicode supports Http://wiki.freepascal.org/LCL_Unicode_Support, older solutions, suitable for 1.44+2.64, previous versions, to 1.6 + Version 3.0 needs a good understanding of Http://wiki.freepascal.org/Better_Unicode_Support_in_Lazarus.

Lazarus 1.44 upgrade to 1.6 UTF8 processing has changed.

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.