Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: mkdir urlencode

  1. #11
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The idea in the link you posted makes sense if you have a few characters that are strange (such as accent marks in Spanish or French), but if you have no characters that will be properly displayed (as in Chinese or Japanese, or anything else with a completely different writing system), there is no point in using that. I'd suggest using md5() to create a "random" name that probably won't overlap with any other names. It won't look pretty, but it won't be any worse than urlencode().

    You can't use the Latin-alphabet forms? I don't see why not, except that it might be difficult to convert them. Google translate can do this automatically, but with their recent decision to not allow use of the API except as a paid service, that might not work for you. I'm sure that if you're willing to pay you can find a way to convert that way. And you might be surprised how many of your uses can understand the Romanization of the Asian scripts-- that's generally how they type anyway, based on the sounds of the characters.


    You can't use the badly encoded string because it won't make sense. You need to investigate the character encodings at EVERY step in your process and figure out where it is going wrong. As I said before, you need to convert to the correct format as needed. My first guess would be to convert from UTF8 (the input) to whatever your OS uses by default, but there might be more complications involved.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  2. The Following User Says Thank You to djr33 For This Useful Post:

    ggalan (10-23-2011)

  3. #12
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    if this
    Quote Originally Posted by ggalan View Post
    手袋
    and this
    Quote Originally Posted by ggalan View Post
    帽子
    result from the same input, then you've definitely got character encoding issues. If you're handling characters like this, you need to be using utf-8 for everything. Getting php (or a database, or your text editor), to use utf-8 is relatively easy. Getting your server's filesystem to play along when you create the directories might be more difficult (especially if you don't admin your own server).

    Honestly, whatever solution you find will probably need to be server-specific (non-portable). I would recommend using a different naming scheme for your actual directories, and using "pretty urls" -either via php or .htaccess- to map the desired paths (with the desired characters) to the correct locations.

    Edit:

    wow, read this.

    Last edited by traq; 10-24-2011 at 04:06 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •