I do a small test task in the Cloud9 cloud: you need to get a line from a csv-file in php, select everything before the first tabulation and put the result in the database. Everything works wonderfully, only krakozyabry enter the base ((Since I am not even a novice, but a senior kindergarten group, I cannot cope. Here’s the code:
<?php // такая русская локаль указана в /etc/locale.alias виртуальной машины, // но setlocale не работает setlocale(LC_ALL, "ru_RU.ISO-8859-5"); // аналогично не работает ( iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("input_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "UTF-8"); // выдает ISO-8859-1 (несмотря на setlocale() вверху) echo mb_internal_encoding(); echo "\n"; $fp = fopen("test2.csv", "r"); $buffer = fgets($fp); $date = strstr($buffer, chr(9), true); // обе строки - UTF-8, проверял mb_detect_encoding() $link = mysql_connect("127.0.0.1", "user", "password"); $database = "db"; mysql_select_db($database); // у базы тоже кодировка UTF-8 if (!$link) { $error = mysql_error(); printf("Cannot connect to database\n$error\n"); } else { printf("Connected to database\n"); } $query = "INSERT INTO table(field) VALUES('$date')"; $result = mysql_query($query); if (!$result) { $error = mysql_error(); printf("Cannot insert into database\n$error\n"); } else { printf("Inserted into database\n"); } fclose($fp); ?> Ps
"And you turn it on - it does not work" (c). The line "July 12th" looks like this: 12 months
Yes, Cloud9 support has been silent for a day.
No, simply importing csv into mysql is impossible - only the first tab is needed (or rather, the line before it).
Yes, dpkg-reconfigure console-setup did (there is ubuntu in the virtual machine). No, it does not help.
In general, you have all the hope.