@@ -40,22 +40,22 @@ |
||
| 40 | 40 | { |
| 41 | 41 | switch ($this->_type) { |
| 42 | 42 | // UTF-8 string as is |
| 43 | - case Element::TYPE_UTF8_STRING: |
|
| 44 | - return $string; |
|
| 45 | - // PrintableString maps directly to UTF-8 |
|
| 46 | - case Element::TYPE_PRINTABLE_STRING: |
|
| 47 | - return $string; |
|
| 48 | - // UCS-2 to UTF-8 |
|
| 49 | - case Element::TYPE_BMP_STRING: |
|
| 50 | - return mb_convert_encoding($string, "UTF-8", "UCS-2BE"); |
|
| 51 | - // UCS-4 to UTF-8 |
|
| 52 | - case Element::TYPE_UNIVERSAL_STRING: |
|
| 53 | - return mb_convert_encoding($string, "UTF-8", "UCS-4BE"); |
|
| 54 | - // TeletexString mapping is a local matter. |
|
| 55 | - // We take a shortcut here and encode it as a hexstring. |
|
| 56 | - case Element::TYPE_T61_STRING: |
|
| 57 | - $el = new T61String($string); |
|
| 58 | - return "#" . bin2hex($el->toDER()); |
|
| 43 | + case Element::TYPE_UTF8_STRING: |
|
| 44 | + return $string; |
|
| 45 | + // PrintableString maps directly to UTF-8 |
|
| 46 | + case Element::TYPE_PRINTABLE_STRING: |
|
| 47 | + return $string; |
|
| 48 | + // UCS-2 to UTF-8 |
|
| 49 | + case Element::TYPE_BMP_STRING: |
|
| 50 | + return mb_convert_encoding($string, "UTF-8", "UCS-2BE"); |
|
| 51 | + // UCS-4 to UTF-8 |
|
| 52 | + case Element::TYPE_UNIVERSAL_STRING: |
|
| 53 | + return mb_convert_encoding($string, "UTF-8", "UCS-4BE"); |
|
| 54 | + // TeletexString mapping is a local matter. |
|
| 55 | + // We take a shortcut here and encode it as a hexstring. |
|
| 56 | + case Element::TYPE_T61_STRING: |
|
| 57 | + $el = new T61String($string); |
|
| 58 | + return "#" . bin2hex($el->toDER()); |
|
| 59 | 59 | } |
| 60 | 60 | throw new \LogicException( |
| 61 | 61 | "Unsupported string type " . Element::tagToName($this->_type) . "."); |
@@ -441,12 +441,12 @@ |
||
| 441 | 441 | return new UTF8String($str); |
| 442 | 442 | } |
| 443 | 443 | switch (self::MAP_ATTR_TO_STR_TYPE[$oid]) { |
| 444 | - case Element::TYPE_PRINTABLE_STRING: |
|
| 445 | - return new PrintableString($str); |
|
| 446 | - // @codeCoverageIgnoreStart |
|
| 447 | - default: |
|
| 448 | - // only reachable during development |
|
| 449 | - throw new \LogicException(); |
|
| 444 | + case Element::TYPE_PRINTABLE_STRING: |
|
| 445 | + return new PrintableString($str); |
|
| 446 | + // @codeCoverageIgnoreStart |
|
| 447 | + default: |
|
| 448 | + // only reachable during development |
|
| 449 | + throw new \LogicException(); |
|
| 450 | 450 | } |
| 451 | 451 | // @codeCoverageIgnoreEnd |
| 452 | 452 | } |