Date delimited display strange characters

Summary

在中文linux form设计时使用dateedit元件,DateOrder选项doNone外的日期分隔出现奇怪字符(MaskEdit等包含/:都会出现同样问题),编译后运行的程序显示正常。

刚debug发现是fpc 单元fpcsrc/packages/rtl-extra/src/unix/clocale.pp引起的,按以下方法修改就可以返回正确的分隔字符。

The dateedit component is used in the design of the Chinese Linux form. Strange characters appear in the date separator except for the dateorder option donone. The compiled program displays normally.

It has just been found in the debug that it is caused by the fpcsrc/packages/rtl-extra/src/unix/clocale.pp of the FPC unit, modify: function FindSeparator(const s: string; Def: char): char; can return the correct separator character.

System Information

Operating system: Chinese Linux

Processor architecture:x86-64, ARM, AARCH64

Compiler version:3.2.2

Steps to reproduce

2022-06-02_18-57-47 2022-06-02_18-59-38 2022-06-02_19-01-14 Before modification: 2022-06-02_09-30-24 After modification: 2022-06-02

Possible fixes

  function FindSeparator(const s: string; Def: char): utf8char;
  var
    i: integer;
    ss:string;
  begin
    FindSeparator := Def;
    i := Pos('%', s);
    if i=0 then
      Exit;
    inc(i);
    SkipModifiers(s, i);
    inc(i);
    if i<=Length(s) then
    //  FindSeparator:=s[i];
      ss:=UTF8Copy(s,i,1);
    if (ss='年') or (ss='月') or (ss='日') then
      FindSeparator := Def
    else
      if (ss='时') or (ss='分') or (ss='秒') then
        FindSeparator := Def
    else
      FindSeparator:=s[i];
  end;
Edited by liao bozhi