parsing - PHP: simplexlsx Parser specialchars

590

hope someone can help me out.

Im using simplexlsx ( http://www.phpclasses.org/package/6279-PHP-Parse-and-retrieve-data-from-Excel-XLS-files.html ) to read out my Excel files and display them/write them into my DB.

Now i have the problem that the class wont parse specialchars like : "Ä, Ü, Ö, ß..." correct i tryed to write a function to fix it, but it wont work.

Hope some of you guys could help me.

Thx so far xQp

// Try

function unhtmlspecialchars( $string ){    
  $string = str_replace ( '&', '&', $string );    
  $string = str_replace ( ''', '\'', $string );    
  $string = str_replace ( '"', '"', $string );    
  $string = str_replace ( '&lt;', '<', $string );    
  $string = str_replace ( '&gt;', '>', $string );    
  $string = str_replace ( '&uuml;', 'ü', $string );    
  $string = str_replace ( '&Uuml;', 'Ü', $string );    
  $string = str_replace ( '&auml;', 'ä', $string );    
  $string = str_replace ( '&Auml;', 'Ä', $string );    
  $string = str_replace ( '&ouml;', 'ö', $string );    
  $string = str_replace ( '&Ouml;', 'Ö', $string );  
  return $string;
}

tryed to get call that function within the simplexlsx.class before return the $value

// edit 2 my try was the to add the function unhtmlspecialchars to simplexlsx.class and call it at the end of the "function value()" before returning the value like this just to test it...

  $value2 = $this->unhtmlspecialchars($value);

        return $value2 ;
488

Answer

Solution:

The solution (as stated by the OP in the comments) is to use

utf8_decode($value);

to restore the special chars in the output.

People are also looking for solutions to the problem: php - mysqli statement not displaying else for no result

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.