The answer to this I believe lies in PHP's htmlspecialchars options.
By default, htmlspecialchars will NOT convert ' into the HTML entity . This is the default (ENT_COMPAT) mode.
So when you execute your code as written, your output would be:
<input name='myData' type='text' value='B#233;nny O'Dr#228;r#246;n'>
Note the coloring, and you'll see why you got what you did.
If you want apostrophes to be converted, you'll have to specify that flag when you call htmlspecialchars;
This will convert both " and ' to their HTML Entities.
(EDIT: Yeah, and SP wont let me put in the special characters lol. I've removed the &'s in front of them to make it not-translate, but you get the picture.