瀏覽代碼

* fixed the conversion of 'UTF-8' to the corresponding code page number
(there's a dummy entry with code page 0 for UTF-8 in the table for
when 0 is searched, but when going from string to number that
entry has to be skipped so the real UTF-8 entry is used)

git-svn-id: trunk@22245 -

Jonas Maebe 13 年之前
父節點
當前提交
d4eb2d7336
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      rtl/unix/winiconv.inc

+ 4 - 2
rtl/unix/winiconv.inc

@@ -655,8 +655,10 @@ begin
   SetCodePage(cpname,$ffff,false);
 
   { simple linear scan, not a common operation and hence not worth
-    building a separate array for }
-  for i:=low(win2iconv_arr) to high(win2iconv_arr) do
+    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
+  }
+  for i:=low(win2iconv_arr)+1 to high(win2iconv_arr) do
     if win2iconv_arr[i].name=cpname then
       begin
         result:=win2iconv_arr[i].cp;