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

Вниз

строки Xe2   Найти похожие ветки 

 
Gu   (2012-01-01 02:53) [0]

Удалено модератором
Примечание: Разбей вопросы на отдельные темы


 
Gu   (2012-01-01 03:02) [1]

+10 пунктом: файлы проектов\юнитов теперь всегд лучше сохранять в utf-8 если используем обявление строковых констант и работу со строками


 
Gu   (2012-01-01 03:14) [2]

++
11. для unicode string (и иногда для wide) при работе в них возможно записать маркер (не помню как нызывается, какаято 3х буквеная абривиатура типа BO?), при наличии которого строка безоговорочно считается unicodestring (особено при операции с текстовыми файлами - такой маркер пишется в начало файла, далее все строики считаются юникодом).
12. в большинстве случаев unicodestring при наличии юникода маркируются (имеют кодировку) utf8, но только при наличии юникода, иначе кодовая страница имеет номер 1200 - универсальный, нейтрал
13. ansistring теперь имеет кодовую страницу и может задаваться как
var
s:type ansistring(866); // по умолчанию = кодовой странице виндов для языка (1251 для ру вроде), что крайне негативно отразится на прогах без учета локализации


 
Gu   (2012-01-01 03:25) [3]

+++
14. Отдельная беда с кодировками. Хотя для этого есть хороший класс TEncoding в нем нет некоторых удобных функций (пока не до конца разобрался), но из строк "по умолчанию" он переводит отлично во все кодировки, а вот обратно - возникают проблемы, особено с юникодом/utf8/koi
15. StrUtils и WideUtils (или както так - полезный модуль) при x64 теперь написны на новом аля pascal_x64. Пока вообще не разбирался. Вроде все работает, но встречал уже некоторые недовольные буржуинские посты, что типа "медлено" (в x86 версии - там реализация на asm, типа stuffstr)

Вроде пока все со строками. Жду проверки понимания и советов.


 
Gu   (2012-01-01 06:26) [4]

++ вопрос также повешен на SO

(http://stackoverflow.com/questions/8691271/how-to-use-the-new-types-of-strings-in-delphi-xe2) но из-за моего корявого английского и моей просьбы его отредактить почти утерял силу (то, что видите по ссылке) - у кого с языком норм техническим - можете перевести отсюда пункты (сам вопрос спрятан в  коменте скрытом, вот (немного изменения есть с оригиналом):

[i]Interested questions:

1. String in Xe2. Everything, that has described more low - whether there are errors in understanding
2. Use of string-operations with DLL
a) "Delphi Dll - Delphi Exe" without the general manager memory (sharemem)
b) "Delphi Dll - for use it of this DLL in other languages" (VB, C ++, C #)

P.S. After even here I will add a test program a separate question (it is possible?) that definitive variant on practice to fix and check up with yours.

Go. Delphi Xe2. Has read much concerning new string (that has found all from new publications).

Problem and ultimate target: it is necessary to write _example_ DLL (Delphi Xe2), for job from it (str-operations with):

1. Applications, write on Delphi Xe2, with use of the general manager of memory (SimpleShareMem, ShareMem)
2. Point 1, only without the general manager of memory
3. Job with DLL from applications of foreign languages, such as VB, C ++, C #
4. All 3 points above should consider, that line variables can be trasfer with use unicode str (EN - not the basic language at a writing of the interface of the user)

Has taken out for itself :

0. We receive enough big problem, though at first sight all like would seem simply
1. By default string now = unicodestring (alias) also are recommended to use Embarcadero
2. Shortstring it is left only for compatibility and more it is desirable be not to using. As before it still one-byte ansistring [255]
3. Now basically string share only on Ansistring - one-byte (without support uni) and widestring, where char=2 byte (with support uni)
3a. Unicode it is not always equal UTF-8 to the coding
4. Length (s), where s = type wide-unicode-string = quantity byte in line DIV 2
5. Single symbols now 2 types = Char, by default now = widechar (alias) two-byte and AnsiChar the one-byte type
6. On how much has understood - unicodestring = combines possibilities ansistring and widestring????
7. Pointers type: Pchar = PWideChar (alias) and PAnsiChar (notice that PUnicodeChar - is not present)
8. At job with pointers type - the type unicodestring is better be not to using in a kind of implicit transformation (and in general it is better use only widestring and sometimes ansistring (only if it is necessary))
9. At memory allocation (allocmem) for PChar now it is necessary to consider always item 4, i.e. always * 2
10. All is implicit constants or operations - it is necessary to lead to type
For example:
Const MyCo ="test "; it is necessary write - as: Const MyCo=Widestring (" test ")
Or
s:=st; it is necessary to write as s:=WideString (st);
Otherwise once happens so, that at line (the type string) will register ansistring, thus _Sometimes_ - change of type of a Str, that further can is negative affect processing of string if we think that type by default the two-byte.
11. Files of projects\units alwaus are better for saving now in utf-8 if it is used declared Str constants and job with string
12. For unicode string (and sometimes for wide) at job in them probably to write down a marker (I do not remember as his name, ...3th char signed, as "BO?" or oth..), at which presence the str unconditionally is considered unicodestring (ex., at operation with text files - such marker is written to the file beginning, further all str are considered uni).
13.More often cases unicodestring at presence UNI are marked (have the coding) utf8, but only at presence uni, differently the code page has number 1200 - universal, neytral
14. Ansistring now has code page and it can be set as

   var
   s:type ansistring (866); //by default = to code page windows, for language that will extremely negatively be reflected in programs without localisation

15. A separate trouble with codings. Though for this purpose there is good class TEncoding in him there are no some convenient functions (has not up to the end understood yet), but from string "by default" it translates perfectly in all codings, and here back - there are problems, especialli with uni / utf8 / ect...
16. StrUtils and WideUtils (or so - the useful module) at x64 now write on new a"la pascal_x64. While did not understand at all. Like all works, but met already some dissatisfied posts, that type "slow" (in x86 versions - there realisation on asm, type stuffstr)

Transfers of string in \ from DLL has understood so, that:

1. At job with the general manager of memory it is better to work with widestring (NOT unicodestring)
2. Without the general manager - only with PChar, PAnsiChar for job with string and-or Pointer for transfer of string through bufer type array of widechar\ansichar
3. For a variant 2 always it is necessary to pass (and to receive back at var) the size of a line or the buffer, considering item 4 above for string.
4. Use of a file for the buffer - the extremely dangerous operation, at its processing it is necessary to pay special attention at its transfer to time and target str variables
5. Functions are extremely undesirable, only procedures

For the general memories manager (exe-dll) are better for using now Simplesharemem. Sharemem remained (and it is quite efficient while) for compatibility and reliable job. Any foreign FastSharemem and тп. Now do not roll

I write here it not on purpose to give info, and with questions to the guru: whether all here is correct and whether there are what remarks.
It is very desirable to hear more opinions, long understood before starting the decision of my big problem - it was long picked and puzzled over all it, the help in the plan - whether all correctly is required and can still what councils.

In advance all answered thanks.
[/i]


 
Gu   (2012-01-01 06:35) [5]

Просьба не убивать тему и помочь новичкам, я думаю вопрос актуален очень, буржуины согласились, что "да, интересно", но предложили его разбить на ту кучу пунктов которую в вопросе, а это равнозначно потери темы. Потом не найдешь концов. Вообщем ребят - прошу помощи:

1. ваше мнение и советы (будут очень полезны). Иди гугли или справку читай - можно не писать - кроме вас этот ответ никаво не устроит

2. если кто поможет - перевод - чтобы полноценно повесить там (тогда там начнут не только гуру с дельфи отвечать но и с др. языков, что оч. хотелось бы). Пока дали 2 дня на оформление (хотя там через 10 мин сразу нарисовался "товаришь" в редакции которого сейчас вопрос отображется. Вообщем к недавнему вопросу не хочу возвращатся, который тут в Курилке обсуждался, но я думаю, что он имеет значение или хотябы на внимание и контроль с вашей стороны.
Спасибо.


 
Eraser ©   (2012-01-01 12:29) [6]

http://edn.embarcadero.com/article/38446
http://edn.embarcadero.com/article/38582
http://edn.embarcadero.com/article/38703


 
Gu   (2012-01-01 13:22) [7]


> Eraser ©   (01.01.12 12:29) [6]

Отлична кста вещь!
Многим поможит. Почти дже против ничего не имею и "ха" тоже бы свой поставил.


 
Gu   (2012-01-01 13:27) [8]


> Eraser ©   (01.01.12 12:29) [6]


Зная, что вы тут один из "приближённых", могу ли я просить вас хотя
бы поверхностно оценить ошибки или ище какие безделухи (помня про 1 число и все остальное).


 
Gu   (2012-01-01 13:35) [9]

Подозреваю так, что тут многое из опислова на справку похоже - НЕТ, просто от руки писал, что думаю (сор, иногд  "А" западает на клаве - потому могут быть неоднозначности).
Блин вчера насмотрелся "Казни Техаса", уже даже думаю куда и тп вствать, бл.., цвет линий тут и ненужное в голову лезет.

вот, вижу просыпается люди, мне бы: что хотел в вопросых выше :) Да и _виновных_ однознач6о канить (тут кста филь пробегал на днях - тм крендель просидел не то 10 не то 20 лет - чуть не кокнули - систр спасла - невновен).  Вот, будь потом присяжным.


 
Gu   (2012-01-01 13:47) [10]

страницу написл текста - сраницу форум скушал.
Ок. Значит порожнее. Только дело остальное поговорка.
Делай что должен.


 
Eraser ©   (2012-01-01 13:54) [11]

> [8] Gu   (01.01.12 13:27)


> Зная, что вы тут один из "приближённых", могу ли я просить
> вас хотя

приближенных к кому? к эмбаркадеро не имею никакого отношения! )
касаемо XE2 - используется в боевом проекте. До выхода 3 апдейта работать было откровенно сложно, компилятор через раз выдавал Internal Error, да и вообще все подглючивало и тормозило. Сейчас полет нормальный. Но такая закономерность повторяется от версии к версии, так что ничего удивительного.


 
Eternal_Shield ©   (2012-01-01 14:00) [12]

Пожалуй и я внесу свою лепту:
Ошибки:
п.4) Length(S)/StrLen(S) - всегда возвращает кол-во символов, но не байт!

По части не точностей это всё. Теперь что касается строчек:
WideString стоит особняком среди всех типов строчек (AnsiString, UnicodeString, ShortString), почему? Это потому, что WideString не имеет полного заголовка. Что за ещё заголовок? А вот он:
TStringHeader = packed record
     Codepage: UInt16;
     ElementSize: UInt16;
     RefCount: Int32;
     Len: UInt32;
   end;

От этого заголовка сабж имеет только последнее поле, т.е. Len;

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

"Что это значит?" - каждый определит это для себя. Надеюсь это пригодится;



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

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

Наверх





Память: 0.5 MB
Время: 0.003 c
15-1324712185
Pavia
2011-12-24 11:36
2012.04.29
Ошибка c памятью


15-1324845002
Юрий
2011-12-26 00:30
2012.04.29
С днем рождения ! 26 декабря 2011 понедельник


2-1325679752
zZZ
2012-01-04 16:22
2012.04.29
проверить символы в строке


15-1324577119
Artem
2011-12-22 22:05
2012.04.29
Как сменить диск при открытии файла в FreePascal?


15-1324333863
Германн
2011-12-20 02:31
2012.04.29
А вот почему на звуковых картах до сих пор один выход?





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский