/** * Set the content. * * If $charset is not defined, it is assumed that $content is encoded in * the charset defined via Zend\Text\Table::setInputCharset() (defaults * to utf-8). * * @param string $content Content of the column * @param string $charset The charset of the content * @throws Exception\InvalidArgumentException When $content is not a string * @return Column */ public function setContent($content, $charset = null) { if (is_string($content) === false) { throw new Exception\InvalidArgumentException('$content must be a string'); } if ($charset === null) { $inputCharset = Table::getInputCharset(); } else { $inputCharset = strtolower($charset); } $outputCharset = Table::getOutputCharset(); if ($inputCharset !== $outputCharset) { if (PHP_OS !== 'AIX') { // AIX does not understand these character sets $strWrapper = StringUtils::getWrapper($inputCharset, $outputCharset); $content = $strWrapper->convert($content); } } $this->content = $content; return $this; }
/** * Set the content. * * If $charset is not defined, it is assumed that $content is encoded in * the charset defined via Zend_Text_Table::setInputCharset() (defaults * to utf-8). * * @param string $content Content of the column * @param string $charset The charset of the content * @throws \Zend\Text\Table\Exception\UnexpectedValueException When $content is not a string * @return \Zend\Text\Table\Column */ public function setContent($content, $charset = null) { if (is_string($content) === false) { throw new Exception\UnexpectedValueException('$content must be a string'); } if ($charset === null) { $inputCharset = Table::getInputCharset(); } else { $inputCharset = strtolower($charset); } $outputCharset = Table::getOutputCharset(); if ($inputCharset !== $outputCharset) { if (PHP_OS !== 'AIX') { // AIX does not understand these character sets $content = iconv($inputCharset, $outputCharset, $content); } } $this->_content = $content; return $this; }