Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Bug with UTF8-Characters in toBinary() #1

Closed
MacGritsch opened this issue Oct 14, 2010 · 4 comments
Closed

Bug with UTF8-Characters in toBinary() #1

MacGritsch opened this issue Oct 14, 2010 · 4 comments
Assignees
Labels
Milestone

Comments

@MacGritsch
Copy link

Hi there,

it seems that there is a bug in the toBinary() function.

my sample php-code does this:

$plist = new CFPropertyList();
$plist->add($tmpDict = new CFDictionary());
$tmpDict->add('name', new CFString("Täst"));
echo $plist->toBinary();

Attention on the german ue-character in "Test" <-----

The output is not readable by NSPropertyListSerialization.

i saw that the last byte in the data is the value 0x16 but it should be 0x19 (compared with binary generated by Apple's Property List Editor!
I had a look into the toBinary()-function in CFBinaryPropertyList.php and found the following:

the function uniqueAndCountValues() counts the $stringSize from the original string value and not the utf16-value. so at the end the $table_offset is incorrect. I am right?

protected $stringSize = 0; // The length of all strings in the file (byte length, not character length)

best regards

Gabriel Gritsch
gabriel@gritsch-soft.com

@rodneyrehm
Copy link
Contributor

I cannot reproduce your problem. I executed your code (saved as UTF-8, of course) and created the same plist with Property List Editor. Both files are identical (verified via md5 checksum).

Is it possible one of your (script) files is not UTF-8? Or your data isn't?

Grüße,
Rod

@MacGritsch
Copy link
Author

o damn, i had an old version, downloaded the new one, but made the tests with the old version :-/

Grüße

Gabriel

@rodneyrehm
Copy link
Contributor

No Problemo.

Mind dropping me a line on what you're doing, why you chose CFPropertyList and how you like it?

@MacGritsch
Copy link
Author

it works and its easy.

I use it to grab data from my local mysql-server over php.

nickl- pushed a commit to nickl-/CFPropertyList that referenced this issue Aug 4, 2012
Adds composer.json and updates .gitignore to hide composer.phar artifacts
@ajsb85 ajsb85 added the bug label Apr 18, 2018
@ajsb85 ajsb85 added this to the 2.0 milestone Apr 18, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants