on the Curl Web Content Markup Language

on the Curl Web Content Markup and Programming Language from www.curl.com and www.curlap.com
Showing posts with label UNICODE. Show all posts
Showing posts with label UNICODE. Show all posts

Monday, August 11, 2014

Curl flashcard maker for Conning's Kodansha Kanji Learner's Course


Did you recently acquire the 2nd Ed. of Halpern's Kodansha Kanji Learner's Dictionary ? The 2nd Ed. has the Unicode value for the kanji. In the example below that value is 9801.

Here is a snap of the Curl applet that I use on my desktop with the Unicode values found in Andrew Scott Conning's 2013 Kodansha Kanji Learner's Course : ( note the 4 markup macros named EmFontSize, CardFontSize, FrontSide and KJ )


Saturday, July 20, 2013

Minimalist haiku markup


Here is a screen shot of thousands of Masaoka Shiki haiku through 2895 in a utf-8 web browser applet with selectable and searchable text :

The input text had headers prefixed with one back-quote character and annotations prefixed with tilde. The present light weight markup is using default Curl macros such as {heading }, {text } and {paragraph } with a document style of TocDocument ( Table of Contents style.)




Saturday, October 13, 2012

Tuesday, May 29, 2012

Japanese Punctuation in UNICODE


Over at http://www.aule-browser.com/kanji/kana-charts-curl.html there is now  a view of all Japanese punctuation listed at ja.wikipedia.org with UNICODE 16-bit and often also the utf-8 for urlencode.

Unfortunately, my favourite HanaMinA font was not adequate to the task, but neither were any of the default Unicode DejaVu, Lucida or Arial fonts.

Here is a snap of the result:


The font-family selection for punctuation characters required the use of a CharClass - a char-map class in Curl.  A total of 4 font families contributed to forming a complete list - most often with half-width presentation preserved.




Monday, May 28, 2012

Curl data versus JSON data (light-weight markup)

Here is the top of a validated JSON katakana data file for Japanese e-learning:

{"katakana": [
{"ucs": "30AB", "utf-8": "E382AB", "kana": "カ", "info": "katakana letter KA"},
{"ucs": "30AC", "utf-8": "E382AC", "kana": "ガ", "info": "katakana letter GA"},
{"ucs": "30AD", "utf-8": "E382AD", "kana": "キ", "info": "katakana letter KI"},
{"ucs": "30AE", "utf-8": "E382AE", "kana": "ギ", "info": "katakana letter GI"},

and here is the Curl:

{let katakana-array:{Array-of Katakana} = {new {Array-of Katakana},
{Katakana "30AB", "E382AB", "カ", "katakana letter KA"},
{Katakana "30AC", "E382AC", "ガ", "katakana
letter GA"},
{Katakana "30AD", "E382AD", "キ", "katakana
letter KI"},
{Katakana "30AE", "E382AE", "ギ", "katakana
letter GI"},

In Curl, both require field definitions for processing - except that the Curl data requres a minimal class definition and a default constructor declaring all fields as being assigned (simple value class).

Of course both could have been reduced to mere arrays of strings, but then the iteration over the data would use no tags or keys.  The Curl version is tagged, but internally:

{define-value-class public final Katakana
  field private constant ucs-code:String || = "0000"
  field private constant utf8-code:String || = "000000"
  field private constant kana-char:String || = {String '\u5B57'} || "字"
  field private constant kana-name:String || = "Ji"
  {getter public {ucs}:String
    {return self.ucs-code}
  }
  {getter public {utf-8}:String
    {return self.utf8-code}
  }
  {getter public {katakana}:String
    {return self.kana-char}
  }
  {getter public {character}:String
    {return self.kana-name}
  }
  {constructor {default ucs:String, utf:String, kana:String, info:String}
    set self.ucs-code = ucs
    set self.utf8-code = utf
    set self.kana-char = kana
    set self.kana-name = info
  }
 }
{include "./katakana-unicode.scurl"}

The iterator block accesses each instance as, e.g., val.ucs and so forth.

In fairness, the JSON could have been

{"katakana-array": [
{"katakana": ["ucs": "30AB", "utf-8": "E382AB", "kana": "カ", "info": "katakana letter KA"]},

but it further complicated iterating over the data.

In the Curl applet the Curl data is processed dramatically faster, naturally.

The JSON data can be used anywhere, e.g., by Pharo Smalltalk or jQuery in web page widgets.

Note: the UTF-8 can be used to urlencode:  "E382B6" becomes %E3%82%B6 for a URL.

Here is one result using the Curl data: (click to view)

 

The applet is located at www.aule-browser.com/kanji/kana-charts.html



Monday, May 14, 2012

joyo kanji

I have added a Curl applet with the joyo kanji from the 2010 revision (that's 2136 dictionary entries from kanjidic2.)


I discuss the features over at my Curl Community blog. Here's the short account: suppose you are at 919; enter 40 and press ENTER.  Once the generic "water" kanji displays, the RIGHT INNER button beside the thin top right-arrow will let you "jump back up" to this 919 "window" kanji.

If you instead jump forward by entering 1926, you can "jump back" with the left "inner" button which is beside of the skinny LEFT arrow at the top.

Why the "jumps" ? The code was needed to add "red" and "green" buttons to a list on which to base "spaced-repetition".

A desktop version for Mac, linux or windows is about 24-hours away.

The list is just a CSV file, so you could move the applet to your own machine if you have a simple script in Rebol or the like - but it will then be a local browser page.  The desktop version will use no browser and store ts state in client-side persistent data instead of cookies.

Saturday, May 5, 2012

Desktop Kanji


While there are a great many useful Kanji webpages for learning, studying and reviewing Japanese, I find that I like my small desktop app.

One reason is that I can flip off English and just leave it sit there on the desktop.  The web browser can close, I can do some programming, and then I give a click and confirm that I recall what that particular Kanji can mean.






Saturday, April 28, 2012

Tuttle Kanji Flashcard app


At http://www.aule-browser.com/kanji/tuttle-henshall-kanji.html there is now a Curl applet for the Tuttle kanji cards ( I am still on the red flashcard set ! )

I used this card as a reminder of the Bayware "Power" Kanji software for Windows 95 later marketed by Transparent Language as Kanji Power2 or some such.  That software had some real strengths in its visual interactive approach to syntax and post-position particles for Who-Where-When-verb basics and modifier-before-modified.

The strength of the Tuttle cards is that each flashcard includes four 2-Kanji combinations with the Kanji of that card.  At my age, my quarrel is with the small font for these - also an issue with the O'Neill paperback.

Font-size is even an issue in Firefox with the Perapera plugin as using CTRL-+ for the browser window content causes the plugin's popups to explode in size.

The Curl* applet illustrated above includes the UNICODE value and the Henshall number.

Request a variant, and I can produce it in about an hour (skip-code, Nelson etc) so long as the information is in the Kanjidic2 XML file.

I will post a download link for the CSV file for the Tuttle flash card set for anyone using Excel or the like.  Now to go look on-line for the "green" set ...

* Curl requires the Curl browser plugin from curl.com or curlap.com (in Japanese.) Curl is in version 8.0 and is very secure and my preferred alternative to Java as both language and browser plugin.  I will add desktop versions today or soon.



Wednesday, April 25, 2012

Kanjidic2 as CSV in HTML and text


To aid a neutral party in assessing approaches to digital dictionaries for Japanese, I have posted an HTML file displaying 10,000+ of the first entries in Kanjidic2 at
  http://kanji.aule-browser.com/kanjidic2-m12.html
I have restricted the dump to the Kanji, the UCS code and a max of 12 of a possible 14 meanings.

There are less than 10,200 due to the fact that in the first 12,155 entries, many had no XML meaning content which was not assigned a language attribute.  Those few thousand may have English translations in markup previously used for foreign languages.

The file can be found as
  http://kanji.aule-browser.com/kanjidic2-m12.csv
with a three line header which you may have to alter for your purposes.

The Kanjidic2 XML file was parsed using the Curl XDM library from curl.com (Nihon-go http://www.curlap.com)

As it stands, the HTML file should be useful for building custom Anki flashcards (themselves stored as SQLite.)   I will be using variant CSV output to construct dictionary software with annotations and spaced-repetition options.  Curl has both CSV and SQLite libraries in addition to the XML libraries.



Saturday, January 21, 2012

netstring markdown md2curl

1)  add a Curl class for parsing netstring such as
14:4:this,1: ,9:netstring,,
with docs note on handling true length of utf-8 strings in light-weight markup.  A PEG parser ?

2)  md2curl is available as name for markdown-to-Curl parser.  See Java PEG parser.  Q: what advantages to having Traits for parsers ?

note: true-length of presented string varies also with Unicode composing marks such as accents for presenting Russian as text in e-learning applications.  Given these issues, a parser in Icon, UNICON or Object Icon seems appealing as an alternative to PROLOG. alternative: compiled Red (Rebol-like).

ironic, in a way, that we move to 64-bit while shy of UTF-16 as we get terabyte DASD and higher-speed networks: 16-bit text could have been planned as the markdown delight (we might even have been spared XML.)

I have a link to this post over at the global Curl community.


Sunday, June 26, 2011

Curl page from Ruby CGI

Over at Aule-Browser I have Ruby CGI generating a page with the following:

This web page is Curl web content (no HTML5 or CSS or JavaScript.)


For information about Curl web markup, programming in Curl and Curl open-source: www.Curl.com


Here is the code and markup used:
{curl 7.0 applet}
{curl-file-attributes character-encoding = "utf8"}
{document-style DefaultDocument}
{set-document-properties background={Background.from-string "linen"}, margin=0.75in}
{text This web page is {bold Curl web content} (no HTML5 or CSS or JavaScript.)}
{paragraph

  For information about Curl web markup, programming in Curl and Curl open-source:
  {link target="_blank", href={url "http://www.curl.com"}, www.Curl.com}
}
 \u0000  {br}  || but note that in a Ruby heredoc I must escape my unicode escape
{paragraph Here is the code and markup used:}
{pre
{curl 7.0 applet} ... etc etc ...  }
                                                                                               


but what that does not show is the simplicity of the CGI:
#!/usr/bin/ruby
# curl_01.cgi

puts "Content-Type: text/vnd.curl"
puts

puts "{curl 7.0 applet}",
<<eos
{curl-file-attributes character-encoding = "utf8"}
{applet
    {compiler-directives careful? = true}
}
{document-style DefaultDocument}

{set-document-properties background={Background.from-string "linen"}, margin=0.75in}

{text This web page is {bold Curl web content} (no HTML5 or CSS or JavaScript.)}

{paragraph

  For information about Curl web markup, programming in Curl and Curl open-source:
  {link target="_blank", href={url "http://www.curl.com"}, www.Curl.com}
}
 \\u0000  {br}  || but note that in a Ruby heredoc I must escape my unicode escape

{paragraph
  Here is the code and markup used:}

{pre |"
{curl 7.0 applet}
etc etc
}
eos

Wednesday, April 6, 2011

Rilke links in Curl

I added a simple web page with links to Rilke's Letters to a Young Poet.  Those pages are themselves in German, so I didn't anticipate any problem.  But when I did a simple edit to the Curl page in a cpanel text editor on my linux host, things began to go wrong.  All that I needed were the characters ä and å in the Windows-1252 encoding. I had chosen this character encodiing to investigate a quirk in the Opera browser.  But how to get the characters into the cpanel editor?

The Windows clipboard kept being "smart" and forcing the characters into 16-bit Unicode (the cahracters above were added using HTML entities - not an option in the source of the Curl text file.

Then a solution dawned on me: don't use an editor. Use the Windows command line! ALT-0228 and ALT-0229 on a cmd command line, mark, copy, paste into the web page for the cpanel editor (with the Curl file carefully re-loaded by the editor in Windows-1252) and all displayed correctly when the applet loaded.

The HTML file in which the Curl is an embedded Object is set to "windows-1252" and the Curl source file is set with a document character encoding on "win32:1252".

Tuesday, April 5, 2011

Curl character encodings

I have added a post above displaying the CharEncoding which Curl 7.0 offers on my Windows installation.

The two lists there cover more than 100 character encodings: both are from the procedure {get‑all‑character‑encodings} (note the use of & # 8209 ; to get that procedure name to appear here with non-breaking hyphens.)

The reason for using them is that Curl offers a CharEncoding class feature to obtain an instance by name - but the docs had no complete list of names, no doubt because the HostEncoding instances will vary by platform and current installation.

One dump is from a breakpoint in the debugger and one is console output from a loop over the {Array‑of CharEncoding} which is returned by the proc.

The types in that container include:

NoneCharEncoding
ShiftJISCharEncoding
EUCJPCharEncoding
UTF8CharEncoding
UTF16CharEncoding
UTF16UnknownEndianCharEncoding
SingleByteCharEncoding
MappedSingleByteCharEncoding
HostEncoding

with most being in the last.  The first is a system default for no encoding specified.

I happened to note that the Curl mother site www.curlap.com pages are encoded in Shift‑JIS.

A few days ago I noticed that some Classical Greek in UNICODE (UTF‑16) displays correctly in the Curl 7.0 IDE but not in any of my Windows web browsers.  I have not yet tested a Curl desktop Dcurl application to see if the UTF‑16 presents correctly in an RIA test.

By way of contrast, the current Pharo Smaltalk environment offers 14 encodings for Workspace contents. EncodedCharSet in Pharo currently has subclasses for GB2312, JISX0208, KSX1001, Latin1 and Unicode.