Solved

Problem with non-printable characters

Posted on 2013-06-30
3
516 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 83

Accepted Solution

by:
Dave Baldwin earned 500 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 83

Expert Comment

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
This article discusses four methods for overlaying images in a container on a web page
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
The viewer will learn how to count occurrences of each item in an array.

730 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