jacquestvanzuydam / laravel-firebird

Firebird Illuminate package for Laravel 5
63 stars 93 forks source link

special characters returns letter b #22

Closed alexrodcruz closed 7 years ago

alexrodcruz commented 8 years ago

This is the query returns:

0 => array:6 [▼ "CODCC" => "001" "DSCCC" => b"INSCRIÇÃO IPSC - PISTOLA" "VALOR" => "150.00" "DT_ATZ" => null "DT_INI_INS" => "2016-02-20" "DT_FIM_INS" => "2016-02-29" ]

Note that in the "DSCCC" => b "INSCRIÇÃO IPSC - PISTOLA" there is a b before starting the registry value, every time the record has some special character that happens, so the laravel can not transform variable in information.

Can you help me please?

jacquestvanzuydam commented 8 years ago

Is this still an issue? Which charset are you using in your configuration? How are you outputting this array, it almost looks like it has been serialised first?

alexrodcruz commented 8 years ago

Yes , continuos the problem... I am using charset UTF-8

alexrodcruz commented 8 years ago

I'm still with this problem. Already changed the encoding to win1252 among others, but the problem persists.

cristiano-pacheco commented 8 years ago

Alex, você conseguiu resolver o problema?

aconteceu comigo tambem..

jacquestvanzuydam commented 8 years ago

@cristianopacheco @alexrodcruz Can I get an idea of your PHP set up, perhaps we can see where the problem lies by starting at the base, I don't think this is an issue within Firebird or Laravel, there will be more of you with this issue.

cristiano-pacheco commented 8 years ago

hello jacquestvanzuydam,

I did some testing in debug mode, and found that the data is with this problem node in the view layer, the controller or the model it does not.

I found also that this problem only occurs when you use the facade DB, when using the Eloquent the problem does not happen.

You have any idea what can be?

ps. when I use pdo_firebird laravel out of this problem does not happen.

I found the solution temporarily, was to convert the data to UTF8 before sending to the view with the code below:

function utf8Encoder ($ data) {     if (! empty ($ data)) {         for ($ i = 0; $ i <count ($ date); $ i ++) {                      attrs = get_object_vars $ ($ data [$ i]);                      foreach ($ attrs as $ key => $ value) {                          $ Data [$ i] -> $ key = utf8_encode ($ value);             }         }     }     return $ data; }

KKSzymanowski commented 7 years ago

@cristianopacheco That's more or less what I had to do when converting ISO-8559-2 to UTF8. No encoding settings worked for me.