Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
有關Import
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
zop  
View profile   Translate to Translated (View Original)
 More options Sep 27, 6:07 am
From: zop <zopu...@gmail.com>
Date: Sun, 27 Sep 2009 03:07:52 -0700 (PDT)
Local: Sun, Sep 27 2009 6:07 am
Subject: 有關Import
請教一個不太屬於TW的問題,
在TW裡,利用Export匯出的HTML,中文的部份會以Unicode的方式儲存,雖然可以利用閱覽器正常閱讀,但是卻有編輯上的困難,
反過來,如果製作一個符合Import的格式,但是內文的中文Unicode直接以中文Big5寫入,則在Import時,會無法偵測文章的存在。

搜尋的結果,Import似乎無法讀取Unicode以外的HTML,
既然如此,小弟的問題是,有沒有辦法使文章在編輯時,中文就以Unicode代碼的方式儲存?


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BramChen  
View profile   Translate to Translated (View Original)
 More options Sep 27, 11:44 pm
From: BramChen <bram.c...@gmail.com>
Date: Sun, 27 Sep 2009 20:44:43 -0700 (PDT)
Local: Sun, Sep 27 2009 11:44 pm
Subject: Re: 有關Import
測試環境: ImportTiddlersPlugin 4.5.5, ExportTiddlersPlugins from
Tiddlytools, Fx 3.5.3, WinXP/SP3

1) ExportTiddlersPlugin 有個 bug
輸出之 header 含建立日期字串未轉碼為 utf8(除含 TW core 之 html 輸出),這會造成後續:

 a) 以編輯器開啟時閱讀困難
 b) 使用 ImportTiddlerPlugin 無法導入以不含 TW core export 的 HTML檔。(TW 內建之
import 則可)

2) 除 1) 外,ExportTiddlerSPlugin 輸出的檔案為 utf8 編碼(如同 TW 存檔)

檔案內容以 utf8 編碼儲存,有利於現今之常見編輯器。

解決 1) 問題的理想方式,應修正 * ExportTiddlersPlugin *
(若未會錯意,這才是 zop 問題所在)
修改 #705

將             var now = new Date().toLocaleString();
改為  var now = convertUnicodeToUTF8(new Date().toLocaleString());

儲存變更後,刷新頁面。

注意事項:
請輸出至新檔案,或刪除原輸出檔(例如: export.html)。

另外,
由於 gecko 以外的瀏覽器未發現有類似之 api 可用 (註一),故此目前 TW 皆以 html entities (&#nnnnn) 的
方式轉換 non-asscii 字元。
雖前述修正 ExportTiddlersPlugin 錯誤,應也可解決其他瀏覽器導入的問題。
但若需以編輯器編寫,最簡單的方式仍建議以 Fx 除檔檔後行之,否則建議使用支援轉換 &#nnnnn 為 utf8 的編輯器。

註一:
a) IE 及可支援 ActiveX 的瀏覽器,曾測試可用 "ADODB.Stream" 轉碼 utf8 後存檔。(
據知,數年前 MicroSoft 因安全問題似已移除 ....
有興趣可試試。

b) 可撰寫 java applet 解決轉碼的問題。
但連使用 IE 操作 TW 也須啟用 javar,且不符 TW 之「單頁式應用」初始訴求。

On 9月27日, 下午6時07分, zop <zopu...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
zop  
View profile   Translate to Translated (View Original)
 More options Sep 28, 4:30 am
From: zop <zopu...@gmail.com>
Date: Mon, 28 Sep 2009 01:30:03 -0700 (PDT)
Local: Mon, Sep 28 2009 4:30 am
Subject: Re: 有關Import
老實說,我是想利用AutoHotKey寫一個程式,當熱鍵啟動之後,會出現一個或幾個文字輸入框,也許就是跟Tiddler一樣三個,標題、內文、
Tag,然後按下輸入之後,會自動將文章加入原先指定好的TiddlyWiki.html裡,也就是說,讓使用者可以有一個隨時可以輸入文字的程式,而
不必特地去打開html然後按東按西輸入,輸入完了再儲存再載入html這樣,單純的像Fx的TiddlySnip一樣,想記就記,按一下熱鍵,打一打
文章,儲存!

不過因為TiddlyWiki.html以一般的文字編輯器打開,都是一堆UTF-8的數字碼,
也許可以在AHK的程式裡轉碼,但是我還沒找到要怎麼做。

提出import這個是因為,我想先實驗export的內容。

而事實上我實驗結果,以單純輸出Tiddler為例,去頭去尾,留下<div> tiddler訊息 </div>的部份就可以了,title
sub-title這些都不需要,但是tiddler的訊息只要是中文輸入全都不行,要嘛英文+數字,要嘛閱覽器材看得懂的數字碼的中文,就是這點麻
煩。

On 9月28日, 上午11時44分, BramChen <bram.c...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BramChen  
View profile   Translate to Translated (View Original)
 More options Sep 28, 9:21 am
From: BramChen <bram.c...@gmail.com>
Date: Mon, 28 Sep 2009 06:21:08 -0700 (PDT)
Local: Mon, Sep 28 2009 9:21 am
Subject: Re: 有關Import

> 不過因為TiddlyWiki.html以一般的文字編輯器打開,都是一堆UTF-8的數字碼,

&#nnnnn;  ?  那是 HTML entities 不是 「UTF-8 編碼」(如前述,TW 在非 Fx (gecko based)
的瀏覽器中存檔)

> 也許可以在AHK的程式裡轉碼,但是我還沒找到要怎麼做。

autohotkey 可以處理轉碼的問題。

Dllcall("WideCharToMultiByte",......)

Dllcall("MultiByteToWideChar",......)

此非 TW 範疇不多贅述,詳細參數、相關說明與使用範例討論請參考:
http://msdn.microsoft.com/en-us/library/dd374085%28VS.85%29.aspx
http://www.autohotkey.com/forum/topic47400.html

> 提出import這個是因為,我想先實驗export的內容。

> 而事實上我實驗結果,以單純輸出Tiddler為例,去頭去尾,留下<div> tiddler訊息 </div>的部份就可以了,title
> sub-title這些都不需要,

1) 無論是要自 TW 中使用 import 或是 append 至 TW 文件,tiddlers 序列化為 html <div> tag 都
應長成這樣:
<div title="TiddlerTitle" modifier="YourName" created="yyyymmddhhss"
modified="yyyymmddhhss" tags="TiddlerTag [[More Tags]]">
<pre>tiddler text.
more texts
....
</pre>
</div>

(<div> 的屬性至少需含 title=" .... ")

2) 若只是輸出為 TW date storeage (可由 TW import 導入)
文件首尾應加上:
<div id="storeArea">

</div>

>但是tiddler的訊息只要是中文輸入全都不行,要嘛英文+數字,要嘛閱覽器材看得懂的數字碼的中文,就是這點麻煩。

比起 TW 得以 javascript 處理轉碼,且得顧及不同瀏覽器兼容。autohotkey 只需一個 function call 即可考
訂,應該還算方便吧。

猜測,你的 atk 輸出檔案的中文為 unicode (或可能是系統編碼,例如:big5 or cp950 之類的)。

若此,只需於寫入檔案前轉為 utf-8 編碼即可 (支援 utf-8 的編輯器看到的就是中文字啦) ,無需理會原 TW 是否以 utf-8 編
碼或存為 html enties。
(當然無需煩惱如何轉為 html enties)

即使日後以非 Fx 的瀏覽器檢視、編輯、存檔,瀏覽器與 TW core 都能適當處理。


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BramChen  
View profile   Translate to Translated (View Original)
 More options Sep 28, 10:01 am
From: BramChen <bram.c...@gmail.com>
Date: Mon, 28 Sep 2009 07:01:56 -0700 (PDT)
Local: Mon, Sep 28 2009 10:01 am
Subject: Re: 有關Import

> autohotkey 可以處理轉碼的問題。

熟悉 linux 的朋友,對 iconv 應該不陌生。windows 版的 iconv.exe 也不錯用:

DllCall("iconv.exe", ....)

iconv.exe

usage:
iconv --help 看看便知

可以到這裡下載:
http://downloads.sourceforge.net/project/mingw/MinGW%20libiconv/libic...

Cygwin 裡頭也有、
或是
http://directory.fsf.org/GNU/

還有

On 9月28日, 下午9時21分, BramChen <bram.c...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BramChen  
View profile   Translate to Translated (View Original)
 More options Sep 28, 10:13 am
From: BramChen <bram.c...@gmail.com>
Date: Mon, 28 Sep 2009 07:13:01 -0700 (PDT)
Local: Mon, Sep 28 2009 10:13 am
Subject: Re: 有關Import
同理:

熟 php、python、ruby、java 也可以比照辦理 ...

(只是不如前面兩種方式便於攜帶、散佈。雖然也可以,但相較之下,「笨重」些而已.)

On 9月28日, 下午10時01分, BramChen <bram.c...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
BramChen  
View profile   Translate to Translated (View Original)
 More options Sep 28, 11:16 am
From: BramChen <bram.c...@gmail.com>
Date: Mon, 28 Sep 2009 23:16:40 +0800
Local: Mon, Sep 28 2009 11:16 am
Subject: Re: 有關Import

2009/9/28 BramChen <bram.c...@gmail.com>

> > autohotkey 可以處理轉碼的問題。

> 熟悉 linux 的朋友,對 iconv 應該不陌生。windows 版的 iconv.exe 也不錯用:

> DllCall("iconv.exe", ....)

> iconv.exe

> usage:
> iconv --help 看看便知

補充說明:
iconv 是轉換檔案,因此是輸出檔案後,執行。

command line 範例:
iconv -f big5 -t utf-8 -c big5.html > utf8.html


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
zop  
View profile   Translate to Translated (View Original)
 More options Sep 28, 8:26 pm
From: zop <zopu...@gmail.com>
Date: Mon, 28 Sep 2009 17:26:20 -0700 (PDT)
Local: Mon, Sep 28 2009 8:26 pm
Subject: Re: 有關Import
真是太感謝了~~~~
我會試試看 ^_^

On 9月28日, 下午11時16分, BramChen <bram.c...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google