Problems with strings copied from a worksheet

1

I have a system that uses the CodeIgniter framework, this system has some fields that the user uses to register things ... The user copies some phrases that are standard from a Libre Office worksheet, and this data that the user registers are registered in my system, and through a Web Service is registered in another system, the problem is that the Phrase Appears there all right kind: "Disposable Black Cup", but when I will use a part of the system that serves to look for something that was registered under this sentence the system does not recognize whitespace and I can not search the registry that has been made.

I know that the Libre Office spreadsheets use UTF-8 encoding, our systems and files that we use use "ISO 8859-1" encoding, so I tried to use a solution that was to decode the Phrase to another encoding, but it did not right and sometimes there is an error saying that I'm using an illegal karate, see below what I tried to do:

function decodeStringAuto($str, $decode = 'ISO-8859-1//TRANSIT') {

  $str = iconv(
      mb_detect_encoding($str, mb_detect_order (), true),
      $decode,
      reduce_multiples($str, ' ', true)
  );

  return $str;
}

I have tried several alternatives that I searched on the internet but I could not solve the problem, does anyone have an alternative?

    
asked by anonymous 09.11.2016 / 11:46

0 answers