mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 14:49:28 +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;
|
dest : pchar;
|
||||||
i : longint;
|
i : longint;
|
||||||
begin
|
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
|
if (cp = 0) or (cp=CP_NONE) then
|
||||||
m:=getmap(current_settings.sourcecodepage)
|
m:=getmap(current_settings.sourcecodepage)
|
||||||
else
|
else
|
||||||
m:=getmap(cp);
|
m:=getmap(cp);
|
||||||
// !!!! MBCS
|
|
||||||
source:=tcompilerwidecharptr(r^.data);
|
source:=tcompilerwidecharptr(r^.data);
|
||||||
dest:=p;
|
dest:=p;
|
||||||
for i:=1 to r^.len do
|
for i:=1 to r^.len do
|
||||||
@ -266,28 +270,7 @@ unit widestr;
|
|||||||
inc(source);
|
inc(source);
|
||||||
end;
|
end;
|
||||||
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;
|
function hasnonasciichars(const p: pcompilerwidestring): boolean;
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user