| Anonymous | Login | Signup for a new account | 2013-05-22 11:27 CEST | ![]() |
| All Projects | FPC | Lazarus: Packages, Patches | Lazarus CCR | Mantis | fpGUI | fpcprojects: fpprofiler |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
| 0020258 | FPC | Documentation | public | 2011-09-15 14:34 | 2012-04-22 00:57 | ||||||||
| Reporter | Nashev | ||||||||||||
| Assigned To | |||||||||||||
| Priority | normal | Severity | major | Reproducibility | N/A | ||||||||
| Status | feedback | Resolution | open | ||||||||||
| Platform | OS | OS Version | |||||||||||
| Product Version | 2.4.4 | Product Build | |||||||||||
| Target Version | Fixed in Version | ||||||||||||
| Summary | 0020258: Use types UTF8String, PUTF8Char etc instead types string and PChar @ work with UTF8 encoded strings and chars | ||||||||||||
| Description | It need to allow strict type checking and for improve autodocumentation ability of RTL sources. I'm about all functions, procedures, methods and properties like: function UnicodeToUtf8(Dest: PUTF8Char; Source: PWideChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif} function UnicodeToUtf8(Dest: PUTF8Char; MaxDestBytes: SizeUInt; Source: PWideChar; SourceChars: SizeUInt): SizeUInt; function Utf8ToUnicode(Dest: PWideChar; Source: PUTF8Char; MaxChars: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif} function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: SizeUInt; Source: PUTF8Char; SourceBytes: SizeUInt): SizeUInt; Also in Lazarus - TOpenDialog.FileName etc must be TUTF8String. | ||||||||||||
| Tags | No tags attached. | ||||||||||||
| FPCOldBugId | 0 | ||||||||||||
| Fixed in Revision | |||||||||||||
| Attached Files | |||||||||||||
Notes |
|
|
(0051858) Nashev (reporter) 2011-09-15 14:48 |
see also similar Lazarus LCL issue 0020259 |
|
(0051881) Marco van de Voort (manager) 2011-09-15 22:21 |
Since utf8* are currently a 100% type alias for the other types, typesafety will not be affected -> changing to documentation |
|
(0051882) Jonas Maebe (manager) 2011-09-15 22:55 |
putf8char does not exist. And if it is ever introduced, it will also be a plain alias for pansichar. Furthermore, bug reports simply mentioning "all functions, procedures, methods and properties like ..." are not very useful. Please provide a patch to add the required types and to change the relevant signatures. |
|
(0051883) Nashev (reporter) 2011-09-15 23:02 edited on: 2011-09-15 23:34 |
there are declared UTFString = type of ansistring; it is not equal UTFString = ansistring; it is force compiler to produce messages about inconsistency when mistyping! And it s good. With PUTF8Char must be too. And "changing to documentation" it is not enough! First documentation for programmer - it is sources, and type for string with stable single byte ANSI chars MUST be differ from type for strings with mixed length chars. |
|
(0051886) Jonas Maebe (manager) 2011-09-15 23:32 |
> there are declared UTFString = type of string; > it is not equal UTFString = string; > it is force compiler to produce messages about > inconsistency when mistyping! And it s good. That is not true. The only thing that does is to allow overloading between string and utf8string. Those types are still considered 100% compatible and the compiler won't give any error, warning or hint when passing one of these types to the other. > With PUTF8Char must be too. That will also only allow overloading. > And "changing to documentation" it is not enough! What Marco meant is that these code changes themselves are documentation changes. They don't change the functionality. Again: a patch is welcome. |
|
(0051887) Nashev (reporter) 2011-09-15 23:35 |
I'n not so familiar with creating patches yet. But i'l try. |
|
(0051889) Nashev (reporter) 2011-09-15 23:46 |
I try to search PUTF8Char at home computer, but found only this: TUTF8Char = String[4]; in http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/objpas/utf8bidi.pp?view=markup [^] UTF8Char = UInt8; in http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/univint/src/MacTypes.pas?view=markup [^] But on work computer i had successfully compiled unit with declaration6 modified to function UnicodeToUtf8(Dest: PUTF8Char; Source: PWideChar; MaxBytes: SizeInt): SizeInt;{$ifdef SYSTEMINLINE}inline;{$endif} Tomorrow i will check it. |
|
(0051890) Jonas Maebe (manager) 2011-09-16 00:01 |
Maybe Lazarus declares the putf8char type somewhere. |
|
(0051906) Nashev (reporter) 2011-09-16 10:48 |
No, sorry. About PUTF8Char it is my mistake - I've modify wstringh.inc, but my program was compiled with ustringh.inc, which contain some functions but with PUnicodeChar instead of PWideChar. |
|
(0058861) Marco van de Voort (manager) 2012-04-22 00:57 |
Relevancy should be reviewed in the light of 2.7.1 changes in time. utf8string is now a separate type? |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-09-15 14:34 | Nashev | New Issue | |
| 2011-09-15 14:48 | Nashev | Note Added: 0051858 | |
| 2011-09-15 21:38 | Marco van de Voort | Project | FPC => Lazarus |
| 2011-09-15 21:39 | Marco van de Voort | Project | Lazarus => FPC |
| 2011-09-15 22:21 | Marco van de Voort | Note Added: 0051881 | |
| 2011-09-15 22:22 | Marco van de Voort | FPCOldBugId | => 0 |
| 2011-09-15 22:22 | Marco van de Voort | Category | RTL => Documentation |
| 2011-09-15 22:55 | Jonas Maebe | Note Added: 0051882 | |
| 2011-09-15 22:55 | Jonas Maebe | Status | new => feedback |
| 2011-09-15 23:02 | Nashev | Note Added: 0051883 | |
| 2011-09-15 23:32 | Jonas Maebe | Note Added: 0051886 | |
| 2011-09-15 23:34 | Nashev | Note Edited: 0051883 | |
| 2011-09-15 23:35 | Nashev | Note Added: 0051887 | |
| 2011-09-15 23:46 | Nashev | Note Added: 0051889 | |
| 2011-09-16 00:01 | Jonas Maebe | Note Added: 0051890 | |
| 2011-09-16 10:48 | Nashev | Note Added: 0051906 | |
| 2012-04-22 00:57 | Marco van de Voort | Note Added: 0058861 | |
| Main | My View | View Issues | Change Log | Roadmap |



