Commit 6c717c2eaa78a9ed9221ec8d84fd9069e976c517

Authored by Caroline Salib
1 parent e2c1c271
Exists in master

Ajustado para não realizar conversão de encode;

portabilis/ieducar#167
Showing 1 changed file with 32 additions and 32 deletions   Show diff stats
ieducar/lib/Portabilis/String/Utils.php
... ... @@ -90,20 +90,20 @@ class Portabilis_String_Utils {
90 90 this method is useful to return latin1 strings (with accents) stored in db, in json api's.
91 91 */
92 92 public static function toUtf8($str, $options = array()) {
93   - $defaultOptions = array('transform' => false, 'escape' => false, 'convert_html_special_chars' => false);
94   - $options = self::mergeOptions($options, $defaultOptions);
95   -
96   - if ($options['escape'])
97   - $str = self::escape($str);
98   -
99   - if ($options['transform'])
100   - $str = ucwords(mb_strtolower($str));
101   -
102   -
103   - $str = utf8_encode($str);
104   -
105   - if ($options['convert_html_special_chars'])
106   - $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
  93 + // $defaultOptions = array('transform' => false, 'escape' => false, 'convert_html_special_chars' => false);
  94 + // $options = self::mergeOptions($options, $defaultOptions);
  95 + //
  96 + // if ($options['escape'])
  97 + // $str = self::escape($str);
  98 + //
  99 + // if ($options['transform'])
  100 + // $str = ucwords(mb_strtolower($str));
  101 + //
  102 + //
  103 + // $str = utf8_encode($str);
  104 + //
  105 + // if ($options['convert_html_special_chars'])
  106 + // $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
107 107  
108 108 return $str;
109 109 }
... ... @@ -113,24 +113,24 @@ class Portabilis_String_Utils {
113 113 this method is useful to store utf-8 string (with accents) get from json api's, in latin1 db's.
114 114 */
115 115 public static function toLatin1($str, $options = array()) {
116   - $defaultOptions = array('transform' => false, 'escape' => true, 'convert_html_special_chars' => false);
117   - $options = self::mergeOptions($options, $defaultOptions);
118   -
119   - if ($options['escape'])
120   - $str = self::escape($str);
121   -
122   - if ($options['transform'])
123   - $str = ucwords(mb_strtolower($str));
124   -
125   -
126   - // apenas converte para latin1, strings utf-8
127   - // impedindo assim, converter para latin1 strings que já sejam latin1
128   -
129   - if (Portabilis_String_Utils::encoding($str) == 'UTF-8')
130   - $str = utf8_decode($str);
131   -
132   - if ($options['convert_html_special_chars'])
133   - $str = htmlspecialchars($str, ENT_QUOTES, 'ISO-8859-1');
  116 + // $defaultOptions = array('transform' => false, 'escape' => true, 'convert_html_special_chars' => false);
  117 + // $options = self::mergeOptions($options, $defaultOptions);
  118 + //
  119 + // if ($options['escape'])
  120 + // $str = self::escape($str);
  121 + //
  122 + // if ($options['transform'])
  123 + // $str = ucwords(mb_strtolower($str));
  124 + //
  125 + //
  126 + // // apenas converte para latin1, strings utf-8
  127 + // // impedindo assim, converter para latin1 strings que já sejam latin1
  128 + //
  129 + // if (Portabilis_String_Utils::encoding($str) == 'UTF-8')
  130 + // $str = utf8_decode($str);
  131 + //
  132 + // if ($options['convert_html_special_chars'])
  133 + // $str = htmlspecialchars($str, ENT_QUOTES, 'UTF-8');
134 134  
135 135 return $str;
136 136 }
... ...