| @@ 154-158 (lines=5) @@ | ||
| 151 | $remaining = 0; |
|
| 152 | } |
|
| 153 | // Two byte sequence: |
|
| 154 | elseif (($value & 0xE0) === 0xC0) { |
|
| 155 | $character = ($value & 0x1F) << 6; |
|
| 156 | $length = 2; |
|
| 157 | $remaining = 1; |
|
| 158 | } |
|
| 159 | // Three byte sequence: |
|
| 160 | elseif (($value & 0xF0) === 0xE0) { |
|
| 161 | $character = ($value & 0x0F) << 12; |
|
| @@ 160-164 (lines=5) @@ | ||
| 157 | $remaining = 1; |
|
| 158 | } |
|
| 159 | // Three byte sequence: |
|
| 160 | elseif (($value & 0xF0) === 0xE0) { |
|
| 161 | $character = ($value & 0x0F) << 12; |
|
| 162 | $length = 3; |
|
| 163 | $remaining = 2; |
|
| 164 | } |
|
| 165 | // Four byte sequence: |
|
| 166 | elseif (($value & 0xF8) === 0xF0) { |
|
| 167 | $character = ($value & 0x07) << 18; |
|
| @@ 166-170 (lines=5) @@ | ||
| 163 | $remaining = 2; |
|
| 164 | } |
|
| 165 | // Four byte sequence: |
|
| 166 | elseif (($value & 0xF8) === 0xF0) { |
|
| 167 | $character = ($value & 0x07) << 18; |
|
| 168 | $length = 4; |
|
| 169 | $remaining = 3; |
|
| 170 | } |
|
| 171 | // Invalid byte: |
|
| 172 | else { |
|
| 173 | throw new Requests_Exception('Invalid Unicode codepoint', 'idna.invalidcodepoint', $value); |
|
| @@ 451-455 (lines=5) @@ | ||
| 448 | $remaining = 1; |
|
| 449 | } |
|
| 450 | // Three byte sequence: |
|
| 451 | elseif (($value & 0xF0) === 0xE0) { |
|
| 452 | $character = ($value & 0x0F) << 12; |
|
| 453 | $length = 3; |
|
| 454 | $remaining = 2; |
|
| 455 | } |
|
| 456 | // Four byte sequence: |
|
| 457 | elseif (($value & 0xF8) === 0xF0) { |
|
| 458 | $character = ($value & 0x07) << 18; |
|
| @@ 457-461 (lines=5) @@ | ||
| 454 | $remaining = 2; |
|
| 455 | } |
|
| 456 | // Four byte sequence: |
|
| 457 | elseif (($value & 0xF8) === 0xF0) { |
|
| 458 | $character = ($value & 0x07) << 18; |
|
| 459 | $length = 4; |
|
| 460 | $remaining = 3; |
|
| 461 | } |
|
| 462 | // Invalid byte: |
|
| 463 | else { |
|
| 464 | $valid = false; |
|
| @@ 572-576 (lines=5) @@ | ||
| 569 | $length = 1; |
|
| 570 | } |
|
| 571 | // Two byte sequence: |
|
| 572 | elseif (($value & 0xE0) === 0xC0) { |
|
| 573 | $character = ($value & 0x1F) << 6; |
|
| 574 | $length = 2; |
|
| 575 | $remaining = 1; |
|
| 576 | } |
|
| 577 | // Three byte sequence: |
|
| 578 | elseif (($value & 0xF0) === 0xE0) { |
|
| 579 | $character = ($value & 0x0F) << 12; |
|
| @@ 578-582 (lines=5) @@ | ||
| 575 | $remaining = 1; |
|
| 576 | } |
|
| 577 | // Three byte sequence: |
|
| 578 | elseif (($value & 0xF0) === 0xE0) { |
|
| 579 | $character = ($value & 0x0F) << 12; |
|
| 580 | $length = 3; |
|
| 581 | $remaining = 2; |
|
| 582 | } |
|
| 583 | // Four byte sequence: |
|
| 584 | elseif (($value & 0xF8) === 0xF0) { |
|
| 585 | $character = ($value & 0x07) << 18; |
|
| @@ 584-588 (lines=5) @@ | ||
| 581 | $remaining = 2; |
|
| 582 | } |
|
| 583 | // Four byte sequence: |
|
| 584 | elseif (($value & 0xF8) === 0xF0) { |
|
| 585 | $character = ($value & 0x07) << 18; |
|
| 586 | $length = 4; |
|
| 587 | $remaining = 3; |
|
| 588 | } |
|
| 589 | // Invalid byte: |
|
| 590 | else { |
|
| 591 | $valid = false; |
|