我使用PHP ZipArchive类来提取.zip文件,它适用于英语,但导致我的本地语言(THAI)出现问题.
我icov('utf-8','windows-874',$zip->getNameIndex($i))用来将utf-8转换为THAI.它适用于文件夹/文件的名称,但不适用于解压缩的.zip文件并导致此错误:
iconv():检测到输入字符串中的非法字符
谁能告诉我这里的问题是什么?
我的PHP代码
$file = iconv('utf-8', 'windows-874', $_GET['File']);
$path = iconv('utf-8', 'windows-874', $_GET['Path']);
$zip = new ZipArchive;
if ($zip->open($file) === TRUE) {
// convert to Thai language
for($i = 0; $i < $zip->numFiles; $i++) {
$name = $zip->getNameIndex($i);
//echo iconv("charset zip file", "windows-874", $name);
//$zip->extractTo($path,$name); -> this problem
}
$zip->close();
echo json_encode('unZip!!!');
} else {
echo json_encode('Failed');
}
Run Code Online (Sandbox Code Playgroud)
解压缩压缩文件后,文件的名称不是我为其设置的名称.

这是我试图设置的名称:

这是我的压缩文件:
https://www.dropbox.com/s/9f4j04lkvsyuy63/test.zip?dl=0
更新
我尝试在Windows XP中解压缩文件,它在那里工作正常,但在Windows 7中没有.
我在使用jdbc的数据库(firebird)中的时间戳有问题
数据库中的数据
timestamp 1994-10-12T00:00:00.000000000-00:00
Run Code Online (Sandbox Code Playgroud)
我用python测试,结果在数据库中是相同的,但是当我使用jdbc(clojure)时
result is 1994-10-11T17:00:00.000000000-00:00
Run Code Online (Sandbox Code Playgroud)
我认为这取决于时区(我在GMT + 7)
如何解决?
谢谢。
此代码
(ns test.core
(:require [clojure.java.jdbc :as jdbc]))
(def firebird-setting {:description "Firebird Database"
:classname "org.firebirdsql.jdbc.FBDriver"
:subprotocol "firebirdsql"
:subname "//localhost:3051//firebird/data/test.fdb"
:user "user"
:password "pass"})
(jdbc/query firebird-setting
"select ts from TestTB")
Run Code Online (Sandbox Code Playgroud)
和结果
({:ts #inst "1994-10-11T17:00:00.000000000-00:00"})
Run Code Online (Sandbox Code Playgroud) 我有这样的插入方法(权重为索引)
implicit def run[A](action: DBIOAction[A, NoStream, _ <: slick.dbio.Effect]): Future[A] = {
db.run(action)
}
def insert(newCategory: CategoryExtractor): Future[Either[String, CategoryResponse]] = {
category.map(_.weight).max.result.flatMap {
case Some(weight) =>
val temp = newCategory.copy(weight = weight+1)
(category += temp).andThen(DBIO.successful(Right(toCategoryExtractor(temp))))
case None =>
val temp = newCategory.copy(weight = 1)
(category += temp).andThen(DBIO.successful(Right(toCategoryExtractor(temp))))
}
}
Run Code Online (Sandbox Code Playgroud)
我叫它两次
insert(CategoryExtractor("1", "name", "scala every where", 0, 0, 0, None)) onComplete {
case Success(data) => println(data)
}
insert(CategoryExtractor("2", "name", "haskell every where", 0, 0, 0, None)) onComplete {
case Success(data) => …Run Code Online (Sandbox Code Playgroud)