Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Прочее";
Текущий архив: 2007.09.16;
Скачать: [xml.tar.bz2];

Вниз

UTF   Найти похожие ветки 

 
del-l-lphi   (2007-08-18 13:01) [0]

Может кто-то сталкивался с такой ситуацией. У меня в переменной типа widestring текст, как проверить является ли текст UTF, если да, то какой от UTF8 или UTF16?


 
wl ©   (2007-08-18 13:04) [1]

utf16 это и есть реальный юникод. а чтобы узнать, что это utf8, то слишком мало данных - для русских букв можно узнать по сигнатурам старшегог байта, для иероглифов - нет (имхо)


 
del-l-lphi   (2007-08-18 21:12) [2]

А как тогда вообще имея данные в UTF8 привести их к формату юникода?


 
palva ©   (2007-08-18 21:30) [3]

Цитата из C:\Program Files\Borland\BDS\4.0\source\Win32\rtl\sys\System.pas

{ PChar/PWideChar Unicode <-> UTF8 conversion }

// UnicodeToUTF8(3):
// UTF8ToUnicode(3):
// Scans the source data to find the null terminator, up to MaxBytes
// Dest must have MaxBytes available in Dest.
// MaxDestBytes includes the null terminator (last char in the buffer will be set to null)
// Function result includes the null terminator.

function UnicodeToUtf8(Dest: PChar; Source: PWideChar; MaxBytes: Integer): Integer; overload; deprecated;
function Utf8ToUnicode(Dest: PWideChar; Source: PChar; MaxChars: Integer): Integer; overload; deprecated;

// UnicodeToUtf8(4):
// UTF8ToUnicode(4):
// MaxDestBytes includes the null terminator (last char in the buffer will be set to null)
// Function result includes the null terminator.
// Nulls in the source data are not considered terminators - SourceChars must be accurate

function UnicodeToUtf8(Dest: PChar; MaxDestBytes: Cardinal; Source: PWideChar; SourceChars: Cardinal): Cardinal; overload;
function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; Source: PChar; SourceBytes: Cardinal): Cardinal; overload;

{ WideString <-> UTF8 conversion }

function UTF8Encode(const WS: WideString): UTF8String;
function UTF8Decode(const S: UTF8String): WideString;

{ Ansi <-> UTF8 conversion }

function AnsiToUtf8(const S: string): UTF8String;
function Utf8ToAnsi(const S: UTF8String): string;



 
Anatoly Podgoretsky ©   (2007-08-18 22:16) [4]

> del-l-lphi  (18.08.2007 21:12:02)  [2]

MultiByteToWideChar



Страницы: 1 вся ветка

Форум: "Прочее";
Текущий архив: 2007.09.16;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.45 MB
Время: 0.043 c
15-1185530750
Vlad Oshin
2007-07-27 14:05
2007.09.16
шахматы. Как сходить?


15-1187508695
Kostafey
2007-08-19 11:31
2007.09.16
Парад ярлыков


2-1187867306
nord489
2007-08-23 15:08
2007.09.16
MainMenu и PopupMenu


15-1187269943
Ega23
2007-08-16 17:12
2007.09.16
О корректном разрыве соединения с сервером БД


11-1169615992
dedo
2007-01-24 08:19
2007.09.16
SmoothDIB





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский