The site I'm building on russian is killing me!

First I have an issue with database storing of russian cyrilic texts because all the letters are stored in some kind of code that I can't figure out... The form of this is У for one letter!

So for every letter that I have shown on page I have this code and therefore my db has to be a lot bigger in order to keep this texts intact. You can view the sample how the page is shown go here...
As you can see the text is shown properly even if you change the encoding of the page...
The reason is the code you can check it out in the source of the page...

I asked on database forum and no one seems to know what the problem is...

Well, I'm passed that problem but if there is someone who knows what the problem is and how to fix it I'll be more than grateful...

The issue I'm having right now is that when I try to post a file (.pdf) on a server which is written in russian cyrilic the file gets posted with no problem but the problem is that it is renamed to the form with that code! So on my downloads page the file is listed properly as it should be but on the server it is writen wrong so I can't link to it (the name shown isn't the name on the server)...

The latest attempt I made is to uplencode the name and I seem to get the right name but the server gives me a 404 URL couldn't be found...

As I can see it there are two ways of solving this:
1. there is a way for me to link this wierd named file through some kind of function that I'm not aware
2. there is a way to save a file with a proper name

The first way is to solve a problem on appearance but not to solve anything and the second way is what I would preffer but I'll go either way...

Can anyone please halp me?

    Take a look at utf-8 charset.

      The trouble is in my understanding that PHP encodes all the data given through form when it is givven in multibyte characters like the case is with Russian, Japanese, Chinese and other encoding...

      How to prevent this?

      Any ideas?

        May be you could try not to use
        the given name during the upload process.

        Let's say you rename on-the-fly the file.

        Imagine :

        The original name is "report.pdf"
        It's "converted" to "xyz.pdf" during
        the upload process.

        You store that name ("xyz.pdf")
        in a table or in a database.

        Then, you generate a new name
        "1.pdf" for instance and you store
        the file content under that name on
        your web server.

        Now on your download page,
        you can put something like :

        <A HREF="1.pdf">xyz.pdf</A>
        

        That way the name displayed is good, and
        the real name is good too.

        The only drawback is that the user
        have to rename from "1.pdf" to
        anything he like ("xyz.pdf" for instance)
        ) when saving file locally.

        A completly different approach :

        Try to use the "accept-charset" attribute
        of the <form> tag

        http://www.w3.org/TR/REC-html40/interact/forms.html#adef-accept-charset

          The idea you have is a brilliant one if I may say so!

          Not tested it yet though, but I'll give it a try and let everybody know about the results...

          It allways seems to me that solutions come in very simple forms and I allways try to find the most complicated ones...

          Thanx a million buddy...

          P.S. The article seems valuable information but I think I'll go the first wy because I can imagine that PHP will convert cyrilic symbols either way, but I'll test it too, so I can reposrt back to you all...

            You saved me from suicide!

            Now it works... The trick worked....

            To explain what exactly I did following the Herve's brilliant advice:
            1. Made a table in my database called pdfs and made it like this:
            id | rname | fname

            rname being real name on the server
            fname being fake name just for showing

            1. On page where I uplad file I make a name like this
              $rname = (rand()*date("d")).".pdf"
              to give it a unique name (I didn't really needed this because the number of files to be uploaded would be smaller than 30 but I wanted it) and save it to the server like this and in the prevously mentioned database table I've insert for a rname $rname and for the fname $_FILES['file1']['name'] where the original name of the file is stored...

            2. On the page where I show files I just query the table and ask for the data where rname is like on the server and get fname to show it and a rname to make a link to the file...

            Like the Herve said the downfall is that the file is being name like 82765131.pdf for instance...

            But there you go... If you can make it work all legal way use tricks...

            Thanx again Herve...

            P.S. Herve, if you need a stupid but hard working slave let me know.. 😉

              Write a Reply...