Search Results

Search found 1174 results on 47 pages for 'escape'.

Page 12/47 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • How to take html markup from a string and escape it to work within a script?

    - by zac
    I am using wordpress as a CMS and trying to allow user fields to be input to populate the info windows in a Google Map script. I am using this to select the id and pull in the content from a custom field : $post_id = 222; $my_post = get_post($post_id); $snip = get_post_meta($post_id, 'custom-field', true); $permalink = get_permalink( $post_id ); $pass_to = '<div class="content">'.$snip.'</div><div class="moreLink"><a href="'.$permalink.'">Find out more » </a></div></div>'; var point = new GLatLng('<?php echo $lat; $lat; ?>','<?php echo $long; $long; ?>'); var marker = createMarker(point,"<?php echo $mapTitle; $mapTitle; ?>", '<?php echo $pass_to; ?>') map.addOverlay(marker); It works fine unless there is any html in the custom-field which breaks the script. I looked at htmlspcialchar and htmlentities but rather than strip everything out I would like to have it escaped so it still works and the html is intact. Any suggestions? I am pretty new to PHP and would really appreciate any pointers.

    Read the article

  • How might I escape Unicode characters in a JSON string using JavaScript?

    - by user293006
    JSON String: { "id":31896, "name":"Zickey attitude - McKinley, La Rosi\u00e8re, 21 ao\u00fbt 2006", ... } this causes an unterminated string in JavaScript. My attempt at a solution is: data.replace(/(\S)\1(\1)+/g, ''); or data.replace(/\\u([0-9A-Z])/, ''); any ideas/solution? Example: http://api.jamendo.com/get2/id+name+url+stream+album_name+album_url+album_id+artist_id+artist_name/track/jsonpretty/track_album+album_artist/?n=13&order=ratingmonth_desc&tag_idstr=jazz last node is the problem, fyi. (/\\u([0-9A-Z])/, '\1');

    Read the article

  • play framework WS API always escape character ';' and '=' in URL

    - by user2512057
    When I send a URL like abc.efg.com/query?para1=cat;para2=dog, play WS API always convert it to abc.efg.com/query?para1=cat%03Bpara2%03Ddog. Of course, there are http:// in the beginning in the URL. my code is as below. val url= "http://abc.efg.com/query?para1=cat;para2=dog" val response = WS.url(url).get() When I use fidder or netmon to look at the data that sent to sever, I found play framework WS (2.1.5) always change to the URL above I mentioned. How do I tell WS not to convert?

    Read the article

  • Does Oracle 10g automatically escape double quotes in recordsets?

    - by bitstream
    I am encountering an interesting issue with an application that was migrated from Oracle 9i to 10g. Previously, we had a problem when a field contained double quotes since Oracle recordsets encapsulated fields in double quotes. Example: "field1"||"field2"||"field "Y" 3"||"field4" Since the move to 10g, I believe that the Oracle client-side driver is parsing the double quotes and replacing them with &quot; Unfortunately I don't have an old 9i environment to test my theory. Have you seen similar behavior or can someone validate if my theory is true?

    Read the article

  • How do I escape a new line character in a .ini file so that Zend_Config_Ini reads it literally?

    - by Nick
    I am trying to store a multiple line e-mail in an ini file using PHP/Zend Framework. My string has new lines characters in it, and when I use Zend_Config_Ini to parse the ini file, the new line characters come back escaped, so they are printed out on screen, instead of a line feed. Example: // ini file message = Hi {0},\n\nThis is a test message.\nGoodbye! is parsed by Zend_Config_Ini as: Hi {0},\\n\\nThis is a test message.\\nGoodbye! which then is printed out in the email as: Hi John,\n\nThis is a test message.\nGoodbye! Instead I want the e-mail to look like this: Hi John, This is a test message. Goodbye! Does anybody know how to achieve this? Thanks!

    Read the article

  • Display error message at top of form

    - by moustafa
    Hello, I'm trying to get the following error to show when some once presses the submit button and has not filled in the required field/s. My PHP code is. <?php require_once("includes/database.php"); require_once("includes/functions.php"); if(isset($_POST['full_name'])) { $required = array('full_name','user_name','email','pwd','pwd2'); $missing = array(); $validation = array( 'full_name' => 'Please provide your full name', 'user_name' => 'Please provide your username', 'email' => 'Please provide your valid email address', 'pwd' => 'Please provide your password', 'pwd2' => 'Please confirm your password', 'userdup' => 'Username already registered', 'emaildup' => 'Email address already registered', 'mismatch' => 'Passwords do not match' ); //Sanitise and clean function $full_name = escape($_POST['full_name']); $user_name = escape($_POST['user_name']); $email = escape($_POST['email']); $pwd = escape($_POST['pwd']); $pwd2 = escape($_POST['pwd2']); foreach($_POST as $key => $value) { $value = trim($value); if(empty($value) && in_array($key,$required)) { array_push($missing,$key); } else { ${$key} = escape($value); } }

    Read the article

  • Vim Stuck In Insert Mode

    - by Levi Hackwith
    I've been using Vim for several months now via my web host (they allow putty access). All of a sudden, the escape key has become unresponsive. I cannot exist insert or any other mode by simply hitting escape. I have to hit F1 which brings up the help in vim and kicks me into command mode. I'm most certain that my escape key on my keyboard is functioning fine since all of my windows shortcuts that use the escape key operate normally. I know this is a ridiculous question and I'm certain there's a lot more to look into regarding a solution. What I really need is a solid lead as to where to start looking. Things that might help: I'm using vim via putty I'm logging in using jailshell I'm not root

    Read the article

  • Vim Stuck In Insert Mode

    - by Levi Hackwith
    I've been using Vim for several months now via my web host (they allow putty access). All of a sudden, the escape key has become unresponsive. I cannot exist insert or any other mode by simply hitting escape. I have to hit F1 which brings up the help in vim and kicks me into command mode. I'm most certain that my escape key on my keyboard is functioning fine since all of my windows shortcuts that use the escape key operate normally. I know this is a ridiculous question and I'm certain there's a lot more to look into regarding a solution. What I really need is a solid lead as to where to start looking. Things that might help: I'm using vim via putty I'm logging in using jailshell I'm not root

    Read the article

  • remaping ctrl+capslock and alt+capslock on ubuntu

    - by qtwtetrt
    I'm trying to disabled capslock and make the following remaps ctrl+capslock = capslock alt+capslock = escape (since my escape key is broken) right now I'm trying to use xmodmap i have only the following keycode 66 = NoSymbol Caps_Lock this disables capslock and maps shift+capslock to capslock but what I what is ctrl+capslock instead of shift+capslock and I have no idea how to map alt+capslock to escape any help is appreciated, thank you

    Read the article

  • Types of quotes for an HTML templating language

    - by Ralph
    I'm developing a templating language, and now I'm trying to decide on what I should do with quotes. I'm thinking about having 3 different types of quotes which are all handled differently: backtick ` double quote " single quote ' expand variables ? yes no escape sequences no yes ? escape html no yes yes Backticks Backticks are meant to be used for outputting JavaScript or unescaped HTML. It's often handy to be able to pass variables into JS, but it could also cause issues with things being treated as variables that shouldn't. My variables are PHP-style ($var) so I'm thinking that might mess with jQuery pretty bad... but if I disable variable expansion w/ backticks then, I'm not sure how would insert a variable into a JS code block? Single Quotes Not sure if escape sequences like \n should be treated as literals or converted. I find it pretty rare that I want to disable escape sequences, but if you do, you could use backticks. So I'm leaning towards "yes" for this one, but that would be contrary to how PHP does it. Double Quotes Pretty certain I want everything enabled for this one. Modifiers I'm also thinking about adding modifiers like @ or r in front of the string that would change some of these options to enable a few more combinations. I would need 9 different quotes or 3 quotes and 2 modifiers to get every combination wouldn't I? My language also supports "filters" which can be applied against any "term" (number, variable, string) so you could always write something like "blah blah $var blah"|expandvars Or "my string"|escapehtml Thoughts? What would you prefer? What would be least confusing/most intuitive?

    Read the article

  • Ad Server does not serve ads in Firefox, but works fine in Chrome, IE, & Safari!?

    - by HipHop-opatamus
    I'm having a strange (likely JavaScript) related issue. I'm running Open X Ad Server ( http://www.openx.org ) which serves ads to the website http://upsidedowndogs.com . The ads load fine every time when visiting the site via Chrome, IE, or Safari, but sometimes don't load at all in FireFox - Hence, it is a client side issue, which leads me to believe its something up with the javascript. The fact that the problem is intermittent, and does not through any error codes to FireBug, also doesn't make it any easier to diagnose and address. Any ideas how to diagnose / address this issue? Thanks! Here is the code generated by OpenX (it goes in the page header - additional code is then used in each ad unit, as seen on the page) if (typeof(OA_zones) != 'undefined') { var OA_zoneids = ''; for (var zonename in OA_zones) OA_zoneids += escape(zonename+'=' + OA_zones[zonename] + "|"); OA_zoneids += '&amp;nz=1'; } else { var OA_zoneids = escape('1|2|3|4'); } if (typeof(OA_source) == 'undefined') { OA_source = ''; } var OA_p=location.protocol=='https:'?'https://ads.offleashmedia.com/server/www/delivery/spc.php':'http://ads.offleashmedia.com/server/www/delivery/spc.php'; var OA_r=Math.floor(Math.random()*99999999); OA_output = new Array(); var OA_spc="<"+"script type='text/javascript' "; OA_spc+="src='"+OA_p+"?zones="+OA_zoneids; OA_spc+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r; OA_spc+=(document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : '')); if (window.location) OA_spc+="&amp;loc="+escape(window.location); if (document.referrer) OA_spc+="&amp;referer="+escape(document.referrer); OA_spc+="'><"+"/script>"; document.write(OA_spc); function OA_show(name) { if (typeof(OA_output[name]) == 'undefined') { return; } else { document.write(OA_output[name]); } } function OA_showpop(name) { zones = window.OA_zones ? window.OA_zones : false; var zoneid = name; if (typeof(window.OA_zones) != 'undefined') { if (typeof(zones[name]) == 'undefined') { return; } zoneid = zones[name]; } OA_p=location.protocol=='https:'?'https://ads.offleashmedia.com/server/www/delivery/apu.php':'http://ads.offleashmedia.com/server/www/delivery/apu.php'; var OA_pop="<"+"script type='text/javascript' "; OA_pop+="src='"+OA_p+"?zoneid="+zoneid; OA_pop+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r; if (window.location) OA_pop+="&amp;loc="+escape(window.location); if (document.referrer) OA_pop+="&amp;referer="+escape(document.referrer); OA_pop+="'><"+"/script>"; document.write(OA_pop); } var OA_fo = ''; OA_fo += "<"+"script type=\'text/javascript\' src=\'http://ads.offleashmedia.com/server/www/delivery/fl.js\'><"+"/script>\n"; document.write(OA_fo);

    Read the article

  • Escaping In Expressions

    The expressions language is a C style syntax, so you may need to escape certain characters, for example: "C:\FolderPath\" + @VariableName Should be "C:\\FolderPath\\" + @VariableName Another use of the escape sequence allows you to specify character codes, like this \xNNNN, where NNNN is the Unicode character code that you want. For example the following expression will produce the same result as the previous example as the Unicode character code 005C equals a back slash character: "C:\x005CFolderPath\x005C" + @VariableName For more information about Unicode characters see http://www.unicode.org/charts/ Literals are also supported within expressions, both string literals using the common escape sequence syntax as well as modifiers which influence the handling of numeric values. See the "Literals (SSIS)":http://msdn2.microsoft.com/en-US/library/ms141001(SQL.90).aspx topic. Using the Unicode escaped character sequence you can make up for the lack of a CHAR function or equivalent.

    Read the article

  • How do I edit keyboard preferences from the command line?

    - by jumpnett
    I want to swap the Caps Lock and Escape key as specified in this answer: Use the keyboard preferences to swap Caps Lock and Escape - seriously, how often do you use Caps Lock? Using vim you will be using Escape all the time, and having it available on the home row makes a huge difference. With the standard Ubuntu desktop, go through the menus: System - Preferences - Keyboard - Layouts tab. Then hit the "Layout Options" button, click on the triangle next to "Caps Lock key behaviour" and select "Swap ESC and CapsLock". but, I'm using Ubuntu Server with no gui, so how would I do this from the command line?

    Read the article

  • Must go through Windows Boot Loader to get to Grub

    - by Zach
    I just installed a fresh copy of Precise alongside Windows 7. I have to separate 750GB hard drives; /dev/sda holds the Windows partitions and /dev/sdb holds the Ubuntu partitions. Other than that, these are fresh installs of both Windows 7 and Ubuntu 12.04. Whenever I boot, Grub doesn't load, instead it goes to a black screen with a single blinking (horizontal bar) cursor in the top right corner. However, if I boot, hit escape right as the BIOS/POST screen finishes up, see the Windows Boot Loader and hit escape to make it go back to the BIOS screen. After the BIOS screen, grub shows up and everything functions normally; I can boot into Ubuntu or Win7. I don't want to have to do the Escape, Escape, Wait, Boot trick every time. I have no idea what would be wrong or what information I could give you guys to help diagnose. I have run a sudo update-grub and it found everything normally. I tried adding nomodeset flag in the /etc/default/grub line GRUB_CMDLINE_LINUX_DEFAULT which searching around made me think might work. Thoughts on what I could do to fix this? EDIT: I've tried changing the boot order so that both drives in the BIOS (both are labeled as "Internal HDD") have had a try booting first. I think the problem may be that every time I boot, the BIOS boot order is different... and I have to reset it. It seems to not be stable... but I'm not sure how to go about fixing that either. The machine has both traditional BIOS and UEFI. It came standard in "Legacy" mode; so it is currently set to boot through Legacy mode. I've reinstalled Ubuntu now, and now if I hit escape at the end of the BIOS/POST startup screen, it takes me to GRUB menu. Otherwise it automatically loads Windows. It seems like GRUB is now the acting bootloader, it just doesn't automatically start that unless I ask it to open a bootloader. In my other machines, it has always automatically started at the end of BIOS/POST. EDIT2: Using gparted, I just looked at my partitions, it would seem that my linux-swap partition is currently flagged as the boot partition for my Ubuntu install. I currently only have 2 partitions: one of "ext4" with a mount point of "/" and flag " "; and the "linux-swap" with mount point " " and flag "boot." If I change the boot flag to be on "/," it does not reliably solve the problem. After 10 boots: 2 Booted successfully to GRUB 5 Booted directly to Windows 7 3 booted to the black screen with the cursor and hung there Further research makes me think this is an issue of the BIOS not reliably booting hard drives in the same order or not finding both hard drives. If I ask it to create a "boot menu" sometimes it has 2 entries for "Internal HDD," sometimes 1. Also the list it creates changes order every time I bring it up; so it is not following a consistent boot sequence. Will report back if this is not an issue with GRUB.

    Read the article

  • TSQL Query: Escaping Special Characters

    - by Abs
    Hello all, I am trying to escape special characters in a TSQL query. I have done this before: SELECT columns FROM table WHERE column LIKE '%\%%' ESCAPE '\' And it has worked. Now I have tried to do this now: UPDATE match SET rule_name='31' ESCAPE '\' But it has failed. I know none of the vlaues have a \ but it should still work. I am guessing its because it needs a LIKE statement but how else can I escape characters that I am adding to a database? In addition, does anyone have a link to all the special characters that should be escaped, I couldn't find any documentation on this! Thanks all for any help

    Read the article

  • how can i convert a .tpl file to a .php file? [closed]

    - by kim
    What do I do?? I am building a site and there is a categories.tpl that I want to go where sitemap.php is. sorry i am brand new to all this. let me try to be more clear.id show you a picture but it is marking it as spam. i have a menu at the top of my site like with any retail site. [About Cart Account and Products]. when you click products it takes to you the sitemap.php file. however i need the content from the categories.tpl to appear instead. (Categories in prestashop is another way of saying products) here is the categories.tpl code: {include file=$tpl_dir./breadcrumb.tpl} {include file=$tpl_dir./errors.tpl} {if $category-id AND $category-active} {$category-name|escape:'htmlall':'UTF-8'} {$nb_products|intval} {if $nb_products1}{l s='products'}{else}{l s='product'}{/if} {if $scenes} <!-- Scenes --> {include file=$tpl_dir./scenes.tpl scenes=$scenes} {else} <!-- Category image --> {if $category->id_image} <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" /> {/if} {/if} {if $category->description} <div class="cat_desc">{$category->description}</div> {/if} {if isset($subcategories)} <!-- Subcategories --> <div id="subcategories"> <h3>{l s='Subcategories'}</h3> <ul class="inline_list"> {foreach from=$subcategories item=subcategory} <li> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}"> {if $subcategory.id_image} <img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_image, 'medium')}" alt="" /> {else} <img src="{$img_cat_dir}default-medium.jpg" alt="" /> {/if} </a> <br /> <a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}">{$subcategory.name|escape:'htmlall':'UTF-8'}</a> </li> {/foreach} </ul> <br class="clear"/> </div> {/if} {if $products} {include file=$tpl_dir./product-sort.tpl} {include file=$tpl_dir./product-list.tpl products=$products} {include file=$tpl_dir./pagination.tpl} {elseif !isset($subcategories)} <p class="warning">{l s='There is no product in this category.'}</p> {/if} {elseif $category-id} {l s='This category is currently unavailable.'} {/if} and here is the sitemap.php include(dirname(FILE).'/config/config.inc.php'); include(dirname(FILE).'/header.php'); include(dirname(FILE).'/product-sort.php'); $nbProducts = intval(Product::getNewProducts(intval($cookie-id_lang), isset($p) ? intval($p) - 1 : NULL, isset($n) ? intval($n) : NULL, true)); include(dirname(FILE).'/pagination.php'); $smarty-assign(array( 'products' = Product::getNewProducts(intval($cookie-id_lang), intval($p) - 1, intval($n), false, $orderBy, $orderWay), 'nbProducts' = intval($nbProducts))); $smarty-display(_PS_THEME_DIR_.'new-products.tpl'); include(dirname(FILE).'/footer.php'); ?

    Read the article

  • Is JSON.stringify() reliable for serializing JSON objects?

    - by Colin
    I need to send full objects from Javascript to PHP. It seemed pretty obvious to do JSON.stringify() and then json_decode() on the PHP end, but will this allow for strings with ":" and ","? Do I need to run an escape() function on big user input strings that may cause an issue? What would that escape function be? I don't think escape works for my purposes. Are there any downsides to JSON.stringify() I need to know about? Thanks

    Read the article

  • Is str.replace(..).replace(..) ad nauseam a standard idiom in Python?

    - by meeselet
    For instance, say I wanted a function to escape a string for use in HTML (as in Django's escape filter): def escape(string): """ Returns the given string with ampersands, quotes and angle brackets encoded. """ return string.replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace("'", '&#39;').replace('"', '&quot;') This works, but it gets ugly quickly and appears to have poor algorithmic performance (in this example, the string is repeatedly traversed 5 times). What would be better is something like this: def escape(string): """ Returns the given string with ampersands, quotes and angle brackets encoded. """ # Note that ampersands must be escaped first; the rest can be escaped in # any order. return replace_multi(string.replace('&', '&amp;'), {'<': '&lt;', '>': '&gt;', "'": '&#39;', '"': '&quot;'}) Does such a function exist, or is the standard Python idiom to use what I wrote before?

    Read the article

  • mysql query not running correctly from inside the application

    - by Mala
    I am completely stumped. Here is my php (CodeIgniter) code: function mod() { $uid = $this->session->userdata('uid'); $pid = $this->input->post('pid'); if ($this->_verify($uid,$pid)) { $name = $this->input->post('name'); $price = $this->input->post('price'); $curr = $this->input->post('curr'); $url = $this->input->post('url'); $query = $this->db->query("UPDATE items SET name=".$this->db->escape($name).", price=".$this->db->escape($price).", currency=".$this->db->escape($curr),", url=".$this->db->escape($url)." WHERE pid=".$this->db->escape($pid)." LIMIT 1"); } header('location: '.$this->session->userdata('current')); } The purpose of this code is to modify the properties (name, price, currency, url) of a row in the 'items' table (priary key is pid). However, for some reason, allowing this function to run once modifies the name, price, currency and url of ALL entries in the table, regardless of their pid and of the LIMIT 1 thing I tacked on the end of the query. It's as if the last line of the query is being completely ignored. As if this wasn't strance enough, I replaced "$query = $this->db->query(" with an "echo" to see the SQL query being run, and it outputs a query much like I would expect: UPDATE items SET name='newname', price='newprice', currency='newcurrency', url='newurl' WHERE pid='10' LIMIT 1 Copy-pasting this into a MySQL window acts exactly as I want: it modifies the row with the selected pid. What is going on here???

    Read the article

  • escaping query string with special characters with python

    - by that_guy
    I got some pretty messy urls that i got via scraping here, problem is that they contain spaces or other special characters in the path and query string, here is some example http://www.example.com/some path/to the/file.html http://www.example.com/some path/?file=path to/file name.png&name=name.me so, is there an easy and robust way to escape the urls so that i can pass them to urlopen? i tried urlib.quote, but it seems to escape the '?', '&', and '=' in the query string as well, and it seems to escape the protocol as well, currently, what i am trying to do is use regex to separate the protocol, path name, and query string and escape them separately, but there are cases where they arent separated properly any advice is appreciated

    Read the article

  • Apostrophe in fstab

    - by Hamy
    Can's get a window's directory to mount due to an apostrophe. The relevant bit of fstab: # Auto-mount windows drive UUID=0C1C51021C50E86A /media/windows ntfs defaults 0 0 # Auto-mount the Music folder /media/windows/Documents\040and\040Settings/Foo\040Name/My\040Documents/My\040Music/Foo's\040Music /home/foo/Music none bind 0 0 Note that I'm using the \040 to escape spaces, but man ascii doesn't (from what I see) have an escape character for a '. I've tried \047 to no avail Thoughts?

    Read the article

  • Can't understand example using continuations

    - by Matt Fenwick
    I'm reading the r6rs Scheme report and am confused by the explanation of continuations (I find it to be too dense and lacking of examples for a beginner). What is this code doing and how does it evaluate to 4? Why does call/cc want an argument that's a function of one argument? How is call/cc's argument used? (+ 1 (call-with-current-continuation (lambda (escape) (+ 2 (escape 3))))) =? 4 This example is from section 1.11 - Continuations.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >