View Single Post
Old 02-22-2015, 07:06 AM   #738
guerrilla
Connoisseur
guerrilla began at the beginning.
 
Posts: 68
Karma: 10
Join Date: Dec 2014
Device: Kindle Paperwhite
Ok, now I'm fighting with dictionary. As I can't find a decent italian dictionary for stardict, I figured it would be nice to take a wiktionary.org dump and convert it to stardict format.

Yet it seems I can't produce a working (in koreader) dictionary. Well, at a certain point it seems I produced a working dictionary, but I can't figure out what went right that time and what is going constantly wrong since then.

I tried everything: utf-8 with dom, utf-8 without dom, not using dos CR, using dos CR, tab format, babylon source format. I'm compiling the source file with stardict editor for windows. The dictionary is always fine with stardict for pc, but it doesn't work in koreader (both stable and nightly build).
Koreader's log says:

Code:
# lookup word: test
# stripped word: test
# JSON data cannot be decoded frontend/JSON.lua:525: frontend/JSON.lua:240: can't parse JSON at char 1 of: save to cache data/dict/test.idx
[{
		"dict":	"test",
		"word":	"test",
		"definition":	"\ndictionary works"
	}]
# dummy result table: test {
	[1] = {
		["dict"] = "",
		["word"] = "test",
		["definition"] = "Nessuna definizione trovata."
	}
}
# showing quick lookup window
# show widget
# close widget
Dictionary files are enclosed so that maybe somebody can tell me what I'm doing wrong.


UPDATE

I uncommented in readerdictionary.lua the line that gives you log info about results_str from sdcv and I compared the log with those from a working entry. It seems that every time JSON.lua fails to decode the result string it's because sdcv added the substring "save to cache data/dict/test.idx" to it. Could that be the reason? (in which case, line 592 in sdcv/blob/master/src/lib/lib.cpp should be the one causing the issue).

Below is the log from the not working entry in the enclosed dictionary. Logs from the working dictionary I mentioned above don't show the string "save to cache data/dict/test.idx" in the results.

Code:
# result str: test save to cache data/dict/test.idx
[{
		"dict":	"test",
		"word":	"test",
		"definition":	"\ndictionary works"
	}]
Attached Files
File Type: zip test.zip (533 Bytes, 157 views)

Last edited by guerrilla; 02-22-2015 at 08:12 AM.
guerrilla is offline   Reply With Quote