Problems with strings copied from a spreadsheet

Asked

Viewed 38 times

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 of a spreadsheet of Libre Office, and this data that the registered user is registered in my system, and through a Web Service is registered in another system, the problem is that the Phrase Appears there all right type: "Black Disposable Cup"but when I use a part of the system that serves to search for something that was registered according to this phrase the system does not recognize the whitespace and I can not search the register that was made.

I know that Libre Office spreadsheets use UTF-8 encoding, our systems and the files we have use "ISO 8859-1" encoding, so I tried to use a solution that was to decode Phrase for another encoding, but it didn’t work out 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 I searched on the internet but I could not solve the problem, someone has an alternative to it ?

  • Libre office user data comes through Ctrl+c //Ctrl+v or the system imports the free file and reads the data ?

  • When you insert "Black Disposable Cup", what does the output look like before and after its function? Put an example of the string with different errors.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.