• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to deal w/ directories and files with French character?

#1
[eluser]minimal design[/eluser]
Hi guys,

I thought I'd ask one of the pros here because this is not my specialty and I don't even know where to start searching:

I wrote a script with Code Igniter which works flawlessly tested locally on my MAMP install on OS X. It's very simple, it scans folders for images, the folders become categories and it displays images as a photo gallery. Here my problem: some of the folders and files have French characters in theme, like: "La boîte à Pâtes.jpg" for instance... On my system, those characters remains the same, but once I FTP the script + images to the live server, they become stuff like: "La bo�te � P�tes.jpg"

The files themselves look fine when I look at them via FTP, so the problem is somehow related to the way the server serves the HTML Everything is setup as UTF-8 in PHP and HTML (so it works locally) which leads me to believe the problem is the way the server is setup... But I'm hosting with Joyent and there servers are supposed to be setup in UTF-8 so I'm not sure where to look from there...

I should point out that within the script I use url_title() to create clean URLs, so I don't have a problem with characters not allowed in URL, as I said, the script works totally fine on my local server...

EDIT: I got a little further in my investigations... on my local dev server, the URL in the browser location bar looks like:
Code:
http:/devserver.com/téstôuille/
but on the live (joyent) server the URL in the browser location bar looks like (extra space added so forum doesn't convert):
Code:
http:/liveserver.com/t % E 9 s t % F 4 uille/

How can I stop this convertion on live server from happening?

Thanks!

#2
[eluser]richthegeek[/eluser]
try viewing the source of the output?

#3
[eluser]minimal design[/eluser]
I put content in first post for brevity. sorry...

#4
[eluser]minimal design[/eluser]
I put content in first post for brevity. sorry...

#5
[eluser]minimal design[/eluser]
I put content in first post for brevity. sorry...

#6
[eluser]Teks[/eluser]
Have you been able to serve any files that have international characters in their name, from the remote server? Try, for instance, ftp-ing a simple, plain html file as a test, and naming it "ĝustøfç.html", or anything else that uses unicode characters. Then, try accessing it normally, using your browser.

If that does not work, that would tell you that your problems have nothing to do with CodeIgniter.

#7
[eluser]minimal design[/eluser]
Hi - thanks for response...

I didn't mean to say it was Ci's fault, I'm just asking here because I'm using CI and that I know they're a bunch of very smart people around here Wink

I ended up having to do something like that:
Code:
$map = $this->utf8_encode_array(directory_map('./projects/'));

With the "utf8_encode_array()" being a recursive function that uses the PHP "utf8_encode()" to check every array keys + values. I"m still looking for a better way ot handle this, and wether or not there's a way to force UTF-8 conversion with a general CI setting (besides the one in conf $config['charset'] = "UTF-8"; which doesn't seem to have any effect in that case

Thanks!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.