php - Unexpected Unicode Characters
one text
I'm trying to isolate where Unicode characters are coming from. I'm seeing the output of unexpected unicode character such as "x0030".
I'm reading a source Excel file in my PHP script and parsing the content.
Here is how I'm loading my Excel file:
//$file is of xlsx format
$spreadsheet = IOFactory::load($file);
$sheetData = $spreadsheet->getActiveSheet()->toArray(null, false, false, true);
$c = 1;
foreach($sheetData as $s)
{
//first row are headers, thus skip
if($c > 1)
{
debug($s);
exit;
}
$c++;
}
Output of $s:
'A' => '_x0030_0013511',
The same file in Excel, looping each char of the string using a macro. The unicode is not visible looking at Excel:
Sub IterateCharactersObject()
Dim ch As Characters, n As Long
With Sheets("mysheet").Range("A2")
For n = 1 To .Characters.Count
Set ch = .Characters(n, 1)
'print position#, character, font name & size to immediate window
Debug.Print "#" & n & "=" & ch.Text, ch.Font.Name, ch.Font.Size
Next n
End With
End Sub
#1=0 Calibri 11
#2=0 Calibri 11
#3=0 Calibri 11
#4=1 Calibri 11
#5=3 Calibri 11
#6=5 Calibri 11
#7=1 Calibri 11
#8=1 Calibri 11
Source