title: Remove UTF-8 DOM in URL - JS & PHP
body: <p>I am having a problem with "strange" chars in URL.</p>
  
  <p>I am using Uploadify script to upload files on server. I am getting a problem when I try onComplete load a preview image.</p>
  
  <p>Here is my js:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(document).ready(function() {
     $('#file_upload').uploadify({
       'height'    : 30,
       'width'     : 100,
       'buttonImg' : '&lt;?=base_url()?&gt;style/images/buttons/button_dodaj_gray.png',
       'cancelImg' : '&lt;?=base_url()?&gt;style/js/uploadify/cancel.png',
       'wmode'     : 'transparent',
       'onComplete': function(event, ID, fileObj, response, data) {
            if( response != "ERROR" )
            {
                var imageSrc = "";
                //imageSrc = "/ads_images_temp/";
                imageSrc = response;
                $('.image_container').html('&lt;img src="&lt;?=base_url()?&gt;'+imageSrc+'"&gt;&lt;/img&gt;');
            }
       },
       'fileExt'   : '*.jpg;*.jpeg;*.png;*.gif',
       'displayData': 'percentage',
       'multi'     : false,
       'uploader'  : '&lt;?=base_url()?&gt;style/js/uploadify/uploadify.swf',
       'script'    : '/tools/upload/product/glavna',
  
       'auto'      : true
     });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>The problem is in line: <code>$('.image_container').html('&lt;img src="&lt;?=base_url()?&gt;'+imageSrc+'"&gt;&lt;/img&gt;');</code>.</p>
  
  <p>I don't get clean URL of image but I get this: <code>%EF%BB%BF768f32dd43cc1f90b79c83cceed57eb2.png</code>.</p>
  
  <p>Filename: 768f32dd43cc1f90b79c83cceed57eb2.png</p>
  
  <p><strong>UPDATE:</strong>
  My PHP file for reading image:</p>
  
  <pre><code>if ( !empty($_FILES) )
              {
                  $config['upload_path'] = $temp_path;
                  $config['allowed_types'] = '*';
                  $config['max_size'] = 4000;
                  $config['encrypt_name'] = true;
  
                  $this-&gt;load-&gt;library('upload', $config);
                  $this-&gt;upload-&gt;initialize($config);
  
                  if( ! ($this-&gt;upload-&gt;do_upload("Filedata"))) // Napaka pri nalaganju slike
                  {
                      //echo $this-&gt;upload-&gt;display_errors('&lt;p&gt;', '&lt;/p&gt;');
                      echo "ERROR";
                  }
                  else // Vse OK, nadaljuj
                  {
                      $img = $this-&gt;upload-&gt;data();
  
                      if($img['image_width'] &gt; 650)
                      {
                          $config['image_library'] = 'gd2';
                          $config['source_image'] = $img['full_path'];
                          $config['create_thumb'] = TRUE;
                          $config['maintain_ratio'] = TRUE;
                          $config['width'] = 650;
  
                          $this-&gt;load-&gt;library('image_lib', $config);
  
                          $this-&gt;image_lib-&gt;resize();
                      }
  
                      // Resize image    
                      $this-&gt;Product_model-&gt;resize_image($img['full_path'], $temp_path.'/crop_'.$img["raw_name"].$img["file_ext"], 160, 120);
                      $this-&gt;Product_model-&gt;resize_image($img['full_path'], $temp_path.'/crop_crop_'.$img["raw_name"].$img["file_ext"], 80, 60);
  
                      //$this-&gt;session-&gt;set_userdata("oddaja_oglasa_glavnaSlika",$img["raw_name"].$img["file_ext"]);
  
                      $imeSlike = $img["raw_name"].$img["file_ext"];
  
                      echo $imeSlike;
                  }
              }
  </code></pre>
  
  <p><strong>EDIT 2:</strong></p>
  
  <p>Chrome console screenshot: <a href="http://imageshack.us/f/818/uploadifychromeconsole1.png/" rel="nofollow">http://imageshack.us/f/818/uploadifychromeconsole1.png/</a></p>
  
  <p>Regards, Mario</p>