* also allow 'cpXXXX' in addition to 'CPXXXX' code page names (mantis )

git-svn-id: trunk@26148 -
This commit is contained in:
Jonas Maebe 2013-11-27 20:27:16 +00:00
parent 5e129b4ac5
commit cddc31a1a8
3 changed files with 21 additions and 0 deletions

1
.gitattributes vendored
View File

@ -12314,6 +12314,7 @@ tests/tstunits/Makefile.fpc svneol=native#text/plain
tests/tstunits/erroru.pp svneol=native#text/plain
tests/tstunits/popuperr.pp svneol=native#text/plain
tests/tstunits/win32err.pp svneol=native#text/plain
tests/tw15169.pp svneol=native#text/plain
tests/utils/Makefile svneol=native#text/plain
tests/utils/Makefile.fpc svneol=native#text/plain
tests/utils/avx/asmtestgenerator.pas svneol=native#text/plain

View File

@ -681,6 +681,16 @@ begin
ansistring (encoding names are always ascii) }
SetCodePage(cpname,$ffff,false);
{ Linux uses cpXXXX instead of CPXXXX }
if (length(cpname)>2) and
(cpname[1]='c') and
(cpname[2]='p') and
(cpname[3] in ['0'..'9']) then
begin
cpname[1]:='C';
cpname[2]:='P';
end;
{ simple linear scan, not a common operation and hence not worth
building a separate array for -- start from index 1 rather than
0, because 0 = fake "code page 0" that maps to UTF-8 as default

10
tests/tw15169.pp Normal file
View File

@ -0,0 +1,10 @@
{ %platform=darwin,linux,freebsd,openbsd,netbsd,solaris }
uses
unixcp;
begin
if GetCodepageByName('cp1250')<>1250 then
halt(1);
if GetCodepageByName('CP1250')<>1250 then
halt(2);
end.