?
Solved

Problem with non-printable characters

Posted on 2013-06-30
3
Medium Priority
?
528 Views
Last Modified: 2013-06-30
Hello!

I've got a problem with some non-printable characters in a UTF-8 HTML document, specifically \u001f and \u001e.

I'm retrieving some data in JSON format, and using json_decode to convert the data into a PHP object.

It seems to be working fine, except those couple of characters. What's the best way to handle this?

I also have the ability to manipulate the data before it's packaged as a JSON string.

Thanks!
0
Comment
Question by:Julian Matz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 39288446
Those are the UTF-8 way of representing the 'RS' (0x1e) and 'US' (0x1f) ASCII control codes.  Those used to be used as separators in data streams.  If you have no use for them, you can just dump them.
0
 
LVL 21

Author Comment

by:Julian Matz
ID: 39288697
I wasn't sure how to strip them, but figured it out with your help. Thank you.

str_replace( array( "\x1e", "\x1f" ), '', $string )

Open in new window

0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39288942
You're welcome, thanks for the points.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In this article, I’ll look at how you can use a backup to start a secondary instance for MongoDB.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question