New user registration is currently disabled due to spam abuse / Регистрация новых пользователей в настоящее время приостановлена из-за злоупотреблений спаммерами

Time to make a dictd protocol support

General discussion

Time to make a dictd protocol support

Postby Michael72 » Wed Mar 12, 2014 2:57 pm

At the moment there is no full DICT-client under Windows. Is it time to make a dictd protocol support in the GoldenDict?
Michael72
 
Posts: 180
Joined: Tue Mar 12, 2013 1:34 pm

Re: Time to make a dictd protocol support

Postby Michael72 » Mon Apr 28, 2014 5:23 pm

This support can be implemented using an external application dict (console dict-client supporting the DICT protocol, see DICT Development Group) which can be connected via the menu Edit - Dictionaries - Sources (F3) in the "Programs" tab. In the Type column has a list of options:
• Audio
• Text
• Html
• According to the prefix
but none of these options is not suitable for use the dict. If I use the "Text" option, then the problem is with the encoding - Windows ANSI characters instead of UTF-8 are displayed: Image
And if I use the "Html" option, then the text is in one line with the loss of paragraphs: Image
I propose to create a new type, which can be called MIME or Auto. The content type will be set by MIME-header. For example:
Content-type: text/html; charset=utf-8
Content-transfer-encoding: 8bit

If the MIME-header is missing, the text is perceived as Plain Unicode Text (UTF-8 charset) by analogy with the "Html" option.
You can to test this MIME-header offer DICT-server: dict.bibleonline.ru;
Dictionaries:
• heb-rus_strong
• ell-rus_strong
Here is an example of how dict provides these MIME-headers:
Code: Select all
dict -M -h dict.bibleonline.ru -s word אגן

From Древнееврейско-русский лексикон Ветхого Завета [heb-rus_strong]:

  Content-type: text/html; charset=utf-8
  Content-transfer-encoding: 8bit
 
  אַגָּן
  <I STYLE='COLOR: GRAY;'>Номер Стронга: 0101</I><BR>
  большая глубокая чаша, таз.

From Иврит-русский словарь: физиология [he-ru_ph]:

 
  אגן הירכיים
  таз

From Hebrew Lexicon (English) [heb-eng_strong]:

 
  אַגָּן
  Strong's Number: 0101
  'aggan \ag-gawn'\
 
  probably from 05059; TWOT - 20a; n m
 
  AV - basons 1, cups 1, goblet 1; 3
 
  1) bowl, basins
 
     1a) basins used in ritual
 
     1b) human body (metaph), curves of the body (simile)
 
     1c) of family of Eliakim (metaph)

From Иврит-русский словарь: посуда для приёма и приготовления пищи [he-ru_hu]:

 
  אַגָן
  тазик

From Иврит-русский словарь: Водопровод, сантехника [he-ru_hp]:

 
  אַגָן
  ванночка (сосуд с низкими бортами)

From Иврит-русский словарь: Эпикризы выписной и переводной — мед. [he-ru_mt]:

 
  אגן
  тазовая область

From Hebrew-Russian Dictionary [Hebrew-Russian]:

 
  אגן
  бухта
  кастрюля
  панорама
  сковорода
  миска
  чашечный
  таз
  кубок
  чарка
  графин
  бутыль

From Hebrew-Russian Dictionary [Hebrew-Russian]:

 
  אגן (2)
  камыш
  покрывать соломой
  тростник
  помчаться
  вылететь
  свирель
  стремительное движение
  сутолока

From Hebrew-Russian Dictionary [Hebrew-Russian]:

 
  אגן הירכיים
  таз

From Hebrew-Russian Dictionary [Hebrew-Russian]:

 
  אגן למי טבילה
  комплект шрифта
  купель

In the above example, a request is sent to the DICT-server with the key -M, so the dict transmits to server the command OPTION MIME (see A Dictionary Server Protocol - OPTION MIME). When received The OPTION MIME, dict-server sends MIME content - arbitrary content without restrictions with reference to their type. GoldenDict should properly handle MIME-headers for each article and in accordance with this header to display the result. In case if there is no MIME-header, then perceived as Plain UTF-8 Text, or as the default MIME-header:
Content-type: text/plain; charset=utf-8
Content-transfer-encoding: 8bit

If received a MIME-header that GoldenDict still can not handle, then you should see a warning message.
Michael72
 
Posts: 180
Joined: Tue Mar 12, 2013 1:34 pm


Return to General

Who is online

Users browsing this forum: Google [Bot] and 10 guests