mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-18 15:59:45 +02:00
* unicode2ascii: give an internalerror when trying to convert to UTF-8, as
this routine does not support this (and isn't/shouldn't be used for that purpose in the compiler) git-svn-id: trunk@31882 -
This commit is contained in:
parent
05bf826342
commit
525685617c
@ -252,11 +252,15 @@ unit widestr;
|
||||
dest : pchar;
|
||||
i : longint;
|
||||
begin
|
||||
{ can't implement that here, because the memory size for p() cannot
|
||||
be changed here, and we may need more bytes than have been allocated }
|
||||
if cp=CP_UTF8 then
|
||||
internalerrorproc(2015092701);
|
||||
|
||||
if (cp = 0) or (cp=CP_NONE) then
|
||||
m:=getmap(current_settings.sourcecodepage)
|
||||
else
|
||||
m:=getmap(cp);
|
||||
// !!!! MBCS
|
||||
source:=tcompilerwidecharptr(r^.data);
|
||||
dest:=p;
|
||||
for i:=1 to r^.len do
|
||||
@ -266,28 +270,7 @@ unit widestr;
|
||||
inc(source);
|
||||
end;
|
||||
end;
|
||||
(*
|
||||
var
|
||||
source : tcompilerwidecharptr;
|
||||
dest : pchar;
|
||||
i : longint;
|
||||
begin
|
||||
{ This routine must work the same as the
|
||||
the routine in the RTL to have the same compile time (for constant strings)
|
||||
and runtime conversion (for variables) }
|
||||
source:=tcompilerwidecharptr(r^.data);
|
||||
dest:=p;
|
||||
for i:=1 to r^.len do
|
||||
begin
|
||||
if word(source^)<128 then
|
||||
dest^:=char(word(source^))
|
||||
else
|
||||
dest^:='?';
|
||||
inc(dest);
|
||||
inc(source);
|
||||
end;
|
||||
end;
|
||||
*)
|
||||
|
||||
|
||||
function hasnonasciichars(const p: pcompilerwidestring): boolean;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user