/[LeafOK_CVS]/lbbs/src/str_process.c
ViewVC logotype

Diff of /lbbs/src/str_process.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.20 by sysadm, Wed Jul 2 04:17:33 2025 UTC Revision 1.21 by sysadm, Sat Oct 18 12:06:10 2025 UTC
# Line 46  int str_length(const char *str, int skip Line 46  int str_length(const char *str, int skip
46                  }                  }
47    
48                  // Process UTF-8 Chinese characters                  // Process UTF-8 Chinese characters
49                  if (c & 0b10000000) // head of multi-byte character                  if (c & 0x80) // head of multi-byte character
50                  {                  {
51                          c = (c & 0b01110000) << 1;                          c = (c & 0x70) << 1;
52                          while (c & 0b10000000)                          while (c & 0x80)
53                          {                          {
54                                  i++;                                  i++;
55                                  c = (c & 0b01111111) << 1;                                  c = (c & 0x7f) << 1;
56                          }                          }
57    
58                          ret += 2;                          ret += 2;
# Line 92  int split_line(const char *buffer, int m Line 92  int split_line(const char *buffer, int m
92                          continue;                          continue;
93                  }                  }
94    
95                  if (c & 0b10000000) // head of multi-byte character                  if (c & 0x80) // head of multi-byte character
96                  {                  {
97                          if (*p_display_len + 2 > max_display_len)                          if (*p_display_len + 2 > max_display_len)
98                          {                          {
99                                  break;                                  break;
100                          }                          }
101    
102                          c = (c & 0b01110000) << 1;                          c = (c & 0x70) << 1;
103                          while (c & 0b10000000)                          while (c & 0x80)
104                          {                          {
105                                  i++;                                  i++;
106                                  c = (c & 0b01111111) << 1;                                  c = (c & 0x7f) << 1;
107                          }                          }
108    
109                          (*p_display_len) += 2;                          (*p_display_len) += 2;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1