@@ -43,22 +43,22 @@ |
||
| 43 | 43 | { |
| 44 | 44 | switch ($this->_type) { |
| 45 | 45 | // UTF-8 string as is |
| 46 | - case Element::TYPE_UTF8_STRING: |
|
| 47 | - return $string; |
|
| 48 | - // PrintableString maps directly to UTF-8 |
|
| 49 | - case Element::TYPE_PRINTABLE_STRING: |
|
| 50 | - return $string; |
|
| 51 | - // UCS-2 to UTF-8 |
|
| 52 | - case Element::TYPE_BMP_STRING: |
|
| 53 | - return mb_convert_encoding($string, 'UTF-8', 'UCS-2BE'); |
|
| 54 | - // UCS-4 to UTF-8 |
|
| 55 | - case Element::TYPE_UNIVERSAL_STRING: |
|
| 56 | - return mb_convert_encoding($string, 'UTF-8', 'UCS-4BE'); |
|
| 57 | - // TeletexString mapping is a local matter. |
|
| 58 | - // We take a shortcut here and encode it as a hexstring. |
|
| 59 | - case Element::TYPE_T61_STRING: |
|
| 60 | - $el = new T61String($string); |
|
| 61 | - return '#' . bin2hex($el->toDER()); |
|
| 46 | + case Element::TYPE_UTF8_STRING: |
|
| 47 | + return $string; |
|
| 48 | + // PrintableString maps directly to UTF-8 |
|
| 49 | + case Element::TYPE_PRINTABLE_STRING: |
|
| 50 | + return $string; |
|
| 51 | + // UCS-2 to UTF-8 |
|
| 52 | + case Element::TYPE_BMP_STRING: |
|
| 53 | + return mb_convert_encoding($string, 'UTF-8', 'UCS-2BE'); |
|
| 54 | + // UCS-4 to UTF-8 |
|
| 55 | + case Element::TYPE_UNIVERSAL_STRING: |
|
| 56 | + return mb_convert_encoding($string, 'UTF-8', 'UCS-4BE'); |
|
| 57 | + // TeletexString mapping is a local matter. |
|
| 58 | + // We take a shortcut here and encode it as a hexstring. |
|
| 59 | + case Element::TYPE_T61_STRING: |
|
| 60 | + $el = new T61String($string); |
|
| 61 | + return '#' . bin2hex($el->toDER()); |
|
| 62 | 62 | } |
| 63 | 63 | throw new \LogicException( |
| 64 | 64 | 'Unsupported string type ' . Element::tagToName($this->_type) . '.'); |