Getting rid of the phrase "ÜT:" using Javascript

Discussion in 'Web Design and Development' started by Ride9650, Oct 9, 2010.

  1. Ride9650 macrumors 6502

    Joined:
    Jun 29, 2007
    #1
    Subject says all.

    Been using the "replace" method. I've tried to simply find it in the string, as well as searching for it as a regular expression and just can't seem to get rid of it!

    thanks!
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    What text encoding are you using on the page? Can you show the code you're working with?
     
  3. Ride9650 thread starter macrumors 6502

    Joined:
    Jun 29, 2007
    #3
    Sure!
    And the text encoding is UTF-8

    Code:
    		
    
    $.getJSON('/twitmap/process/',function(json,status){
    		
    			
    			$.each(json.results,function(i,tweet){
    				
    			//other non-relevant code
    				
    				
    			
    			   $(".result").append('<p>'+tweet.location.replace(/iPhone:/,"").replace(/ÜT:/,"").replace(/Pre:/,"")+'</p><br/>');
    			  
    
    			   
    			});
    			
    				
    		});
    EDIT:Almost forgot, this might be important too:
    (I know I don't have to use PHP to initiate the search but for some reason my client wants me to)
    Code:
    
    $ch = curl_init();
    		
    		$query = "&q=twitter&rpp=10&geocode=37.781157,-122.398720,9mi";
    		$url = "http://search.twitter.com/search.json?callback=?".$query;
    		
    		//options
    		curl_setopt($ch,CURLOPT_URL,$url);
    	
    		$results = str_replace("ÜT:"," ",curl_exec($ch));
    		
    		
    		
    		curl_close($ch);
    
     
  4. Ride9650 thread starter macrumors 6502

    Joined:
    Jun 29, 2007
    #4
    Ah! Figured it out. Thank you very much Anglewatt for asking about the encoding because that made me think of how I saw "\u00dcT:" in the returned unaltered JSON stream instead of "ÜT:". I had figured that the encoding was probably to blame but for some reason didn't think of trying to search and replace "\u00dcT:"

    thanks!
     

Share This Page