[Jprogramming] passing unicode argument to dll
Kairit Sirts
karambula at hot.ee
Thu Sep 27 03:54:38 HKT 2007
I experimented a little and got the following result.
If I leave the argument in UTF8 format (this is the default format, when typing in some string from the keyboard, right?) then I will get domain error and variable pointing to memory address is 0
syllabification 'nägin'
|domain error: memr
| syllables=:zerocut> memr aadress,0,128
aadress
0
If I pass the argument in unicode format then dll will process the word, but eliminates the umlaut characters
syl =: syllabification ucp 'nägin'
syl
┌──┬───┐
│n│gin│
└──┴───┘
datatype each syl
┌───────┬───────┐
│literal│literal│
└───────┴───────┘
I have also another question regarding umlaut characters: when I write text into file for example 2500 characters then the file is saved in UTF format, but when for example 3000 characters then the file is saved in ANSI format. I can't see any sense in that behaviour.
Kairit Sirts
> -----Original Message-----
> From: programming-bounces at jsoftware.com [mailto:programming-
> bounces at jsoftware.com] On Behalf Of Eric Iverson
> Sent: Sunday, September 23, 2007 10:14 PM
> To: Programming forum
> Subject: Re: [Jprogramming] passing unicode argument to dll
>
> If the data is utf8 then you want *c declarations. If the data is utf16
> then
> you want *w declarations.
>
> ----- Original Message -----
> From: "Kairit Sirts" <karambula at hot.ee>
> To: "'Programming forum'" <programming at jsoftware.com>
> Sent: Sunday, September 23, 2007 6:34 AM
> Subject: [Jprogramming] passing unicode argument to dll
>
>
> Hi!
>
> I pass an unicode argument to dll and I expect to get back also unicode
> argument, but the result is type of literal.
>
> word
> ┌──────┐
> │nägin│
> └──────┘
> datatype >word
> unicode
>
>
> script_z_ '~system\main\dll.ijs'
> syllabify=: >@{.@('C:\j601\addons\syllabif\syllabif.dll syllabify *c
> *c'&cd)
>
> NUL =. 0 { a.
> zerocut =: {.~i.&NUL
>
> syllabification =: 3 : 0
> 1!:44 'C:\j601\addons\syllabif'
> r =. syllabify < y
> aadress =. (;(0{r))
> syllables =. zerocut > memr aadress, 0, 128
> jaga syllables
> )
>
>
> The fragment " memr aadress, 0, 128" will give the result:
>
> memr aadress, 0, 128
> n-gin
>
> datatype memr aadress, 0, 128
> literal
>
> How to save the umlaut charaters while processing? It is not restricted to
> use umlaut characters in this dll. Strange thing is, that I have used this
> dll for this task already earlier and I can't recall there was such
> problem
> then
>
> Kairit Sirts
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list