Changeset 14 for Common/UTF8.php
- Timestamp:
- Aug 3, 2021, 11:36:12 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UTF8.php
r10 r14 526 526 } 527 527 528 function ToUTF8 ($String, $Charset = 'iso2')528 function ToUTF8string(string $String, string $Charset = 'iso2'): string 529 529 { 530 530 $Result = ''; … … 540 540 } 541 541 542 function FromUTF8( $String, $Charset = 'iso2')542 function FromUTF8(string $String, string $Charset = 'iso2'): string 543 543 { 544 544 $Result = ''; … … 546 546 for ($I = 0; $I < strlen($String); $I++) 547 547 { 548 if (ord($String {$I}) & 0x80) // UTF control character548 if (ord($String[$I]) & 0x80) // UTF control character 549 549 { 550 if (ord($String {$I}) & 0x40) // First550 if (ord($String[$I]) & 0x40) // First 551 551 { 552 552 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset])); 553 $UTFPrefix = $String {$I};553 $UTFPrefix = $String[$I]; 554 554 } 555 else $UTFPrefix .= $String {$I}; // Next555 else $UTFPrefix .= $String[$I]; // Next 556 556 } else 557 557 { 558 558 if ($UTFPrefix != '') $Result .= chr(array_search($UTFPrefix, $this->CharTable[$Charset])); 559 559 $UTFPrefix = ''; 560 $Result .= $String {$I};560 $Result .= $String[$I]; 561 561 } 562 562 }
Note:
See TracChangeset
for help on using the changeset viewer.