#24180 closed defect (bug) (invalid)
Update option
Reported by: | Looimaster | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
$widget_text = array ( 2 => array ( 'title' => '', 'text' => '<div>Copyright © 2000–2013. All right reserved.</div>', 'filter' => false, ) ); update_option( 'widget_text', $widget_text );
The above returns error on 2000–2013 part (I bet it tries to evaluate that) and database table contains a string that stops at exactly 2000 part (minus is skipped).
WP3.6 alpha.
Change History (6)
#3
@
12 years ago
In Notepad++, choose "Encoding" > "Convert to UTF-8 without BOM" and save the file. That should fix it.
#4
@
12 years ago
One more information: I used var_export() in PHP to generate this array. Then Ctrl+C and Ctrl+V to the Notepad++. I can replace that with "dash" character instead of "-" from keyboard. I already managed to make it work :) I'm just reporting it because it may be a bug.
#5
@
12 years ago
- Keywords reporter-feedback removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version trunk deleted
The issue here is caused by trying to insert a non-UTF-8 character into a UTF-8 database table. MySQL truncates the string at the invalid character.
If the data to be inserted is coming from a file, a simple copy/paste is not enough when dealing with different encodings, you need to make sure the file is encoded in UTF-8 as well.
What does it say?
Could not reproduce neither the error nor the incomplete saving. This is what I got in the database:
The dash here is the en dash, encoded in UTF-8.
Related: #21109