quotes

SmartyPants-PHP not working for string's submitted by post/get?

Finally gave up on my own pretty-quotes function to use SmartyPants-PHP's one-stop SmartyPants() ... except it seems that it doesn't do pretty curly-quotes (just straight quotes) for strings submitted from post forms or get url's. Tested curly quotes to show with SmartyPants on a string defined in the same doc. Replace that string with ...

PHP URL Encoding/Decoding Pretty Quotes across form field's %u2019

For some reason, after submitting a string like this Jack’s Spindle from a text form to php, I get: Jack%u2019s Spindle This is not what PHP's urlencode() would do, which would be Jack%92s+Spindle or rawurlencode() = Jack%92s%20Spindle Thus, urldecode() and the raw version don't work to decode that string... Is there another function ...

PHP - "Sal's mall is $emo" vs "Sal's mall is ".$emo - string with quotes concatenation efficiency

In PHP, which is a better way to concatenate strings (with a single-quote) in terms of resources? "Sal's mall is $emo." or "Sal's mall is ".$emo.'.' or 'Sal\'s mall is '.$emo.'.' ...

PHP echoing HTML code with more PHP included

I have blocks of HTML code in a MySQL database and my framework needs to print these within a PHP template which will be outputted to the browser. To do so I make this call: </tr> <!-- Section 3 --> <?php echo SIN_SiteView::get('section3') ?> <tr> Which gets the code either from the APC or MySQL, now the code it obtains looks ...

The Zen of Ruby

Hi, I have written a Ruby gem named 'this'. Get it here http://rubygems.org/gems/this. Purpose of 'this' is to show quotes of 'The Zen of Ruby' whenever you "require 'this'". As I could not find any equivalent zen quotes for Ruby, currently I am using 'The Zen of Python' (PEP 20). Extremely sorry for using it :) Can you guys suggest me...

Quoting and escaping text strings advice

I am mainly C++ programmer who returns to PHP seasonly. Every time I return I spend time to get used to echo/print correct JavaScript/HTML/CSS regarding the single quote and double quote ...etc. I need an advice in the form of a set of rules to follow for good escaping practice. Edit This is a small example for my bad working code tha...

python equivalent to perl's qw()

I do this a lot in Perl: printf "%8s %8s %8s\n", qw(date price ret); However, the best I can come up with in Python is print '%8s %8s %8s' % (tuple("date price ret".split())) I'm just wondering if there is a more elegant way of doing it? I'm fine if you tell me that's it and no improvement can be made. ...

DB query and quotes

If I use http://site.com/index.php?page=45 everything looks ok (wanted page loads). But when I go through http://site.com/index.php?page=45' or http://site.com/index.php?page=45" (quotes are added after digits) page prints an error: Unhandled Exception (Debug) You have an error in your SQL syntax; check the manual that corresponds to y...

How to enter quotes in a String?

I want to initialize a String in Java, but that string needs to include quotes; for example: "ROM" I tried doing String value = " "ROM" ";, but that doesn't work. How can I include "s within a string? ...

SimplePie Encoding

I am using SimplePie to parse and display an xml feed on my site. I have two separate rss feeds and I running each one through SimplePie then displaying them in the side bar. The problem I am having is that each feed contains smart quotes and they are displayed as odd characters in the browser. SimplePie has the encoding set as UTF-8,...

Quoatation escaping -- rsync from bash

I normally work these things out reasonably quickly, but this one is a headache. I have a shell script that loads some info about where to connect to and how from a text file, this is done using the read command. This works. It stores the arguments to be sent onto RSync in a variable call $rsyncargs. I want to use the RSync arg -e whic...

Pass application via argv in Applescript

I would like to pass the name of an application to an applescript and then perform some actions on it in the script. I've tried the following: set app_name to item 1 of argv tell application app_name to ... This doesn't work. I've tried set app_name to quoted form of item 1 of argv which seems to append single quotes, (doesn't work...

Using <div class="something"> inside a jQuerty replaceWith() function

I am working on a PHP document which has jQuery code in it. I am using a replaceWith() functions to strip outer divs and replace with span. it seems I can only replace it with <span> and not <span class="something"> Why is that? Edit: Here is an example of the code: Thanks Dave, but I actually use the second option in your code above,...

learning about single and double quotes (.),("), and (')

Can you tell me what is the different using (')single quotes inside (")quotes and (")quotes inside (')single quotes? and at concat, what is the meaning of this '".$bla."' I still can not distinguish them. ...

In MySQL, ' results in error, ` works fine. why?

$query = "SELECT * FROM `users` WHERE `username` = 'admin'";#works $query = "SELECT * FROM 'users' WHERE 'username' = 'admin'";#does not work Is this yet another quirk Im going to have to get used to, or is something funny going on? ...

javascript \" \' im confused

Hey, I'm busy on little JavaScript item, but I got confused by the next rule; <a href="#" onclick="removeMap('+ \"test\" +')" style="float:right; margin-right: 30px;"><img src="images/icons/collapse.gif"></a><br/>' It doesn't take the onclick remove map action. I don't know what I have to put between the () to make I can put text ther...

How can I quote a long string in Perl?

I usually use simple quotes, but sometime I get very long lines which I can't break and also need to use escape characters, so I get something like this: my $str = "select query_accession,query_tag,hit_accession,hit_tag,significance from summaryTables where query_id = \'$query_id\';" I know there are various other ways for representin...

Typographer's quotes in PHP on Yahoo

My client is a small newspaper and provides stories with typographer's quotes instead of "straight" quotes. The stories are assembled into HTML by PHP. On my Apache server, they display fine, but on Yahoo, where my client's site is located, they are all replaced by question marks. To fix this problem, I wrote the following function in P...

How to escape double quotes in title attribute

Hi, I am trying to use a string that contains double quotes in the title attribute of an anchor. So far I tried these: <a href=".." title="Some \"text\"">Some text</a> <!-- title looks like `Some \` --!> and <a href=".." title="Some &quot;text&quot;">Some text</a> <!-- title looks like `Some ` --!> Please note that using single q...

Using double quotes vs single quotes when passing string as a parameter to function

hi, i have a very strange problem, well not really a problem because i've fixed it but still, when i'm trying to connect to mysql db with: mysql_connect("server", "user", "pass") or die(mysql_error()); im getting: Access denied for user 'user'@'server' (using password: YES) but when i change the quotes around the password to sin...