0

I need to create directories in utf-8 Cyrillic. i use mkdir function for this, then i try to do:

$img_dir = './img/product/'.htmlspecialchars($_POST['title']);
if(!is_dir($img_dir)){
  mkdir($img_dir, 0700);
};

in $_POST['title'] i have titles of product something like that : "Кеды", "Макасины" but this function create folders with such names: "Кеды","Макасины".

This is associated with the coding of my OS? How can i solve this problem?

Anton Sementsov
  • 1,196
  • 6
  • 18
  • 34
  • I don't know what you are trying to do with `htmlspecialchars` but if you want to sanitize filenames, this might be helpful http://stackoverflow.com/questions/2668854/sanitizing-strings-to-make-them-url-and-filename-safe What kind of OS and what file system are you using? – Basti Mar 15 '12 at 15:30

1 Answers1

1

Instead of htmlspecialchars you need to use htmlentities, which includes the whole cyrillic alphabet.

$img_dir = './img/product/'.htmlentities($_POST['title']);
if(!is_dir($img_dir)){
mkdir($img_dir, 0700);
};
andr
  • 15,970
  • 10
  • 45
  • 59
bfb 1985
  • 29
  • 1