[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Strip characters from right of string

Posted on 2004-09-16
2
Medium Priority
?
699 Views
Last Modified: 2012-05-05
Hi
I have entries in a mysql table that I read out, and then display on a page. The entries are the names of images, but some contain spaces in the name, eg. Image 234.jpg

What happens now is that I do this:
...
$pict = $myrow["picture"];
      if($pict) {
      $picture = trim($pict);
      $picture = rawurlencode($picture);
      // $picture = rtrim($picture, "%5C%22");
      }
...

For some reason, when I look at the source of the resulting page, there are "%5C%22" added to the end of the image name in the SRC line, causing the image not to be displayed.
As you can see, I tried an rtrim specifying these characters, but it does not remove them...

Any ideas?
0
Comment
Question by:psimation
[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 Comments
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 120 total points
ID: 12079455
Looks like a previous error when assigning name to image, because hex sequence correspond to:  \"
0
 
LVL 48

Assisted Solution

by:hernst42
hernst42 earned 80 total points
ID: 12079471
%5C%22 urlencoded is \", so you might try

$picture = rawurlencode(preg_replace('/\\"$','',$picture));

to remove that garbage before you urlencode that string.
0

Featured Post

Independent Software Vendors: 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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

649 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