[reorderd to remove top-posting]
stefoid wrote:
[me:]
> > Why are you working in UTF8 using Java Strings ? Indeed /how/ are you
> > doing it -- I would put it somewhere between impossible and dangerously
> > difficult and confusing.
> >
> good question. An iAppli is something like an applet, designed to go
> into a cutdown java virtual machine to fit inside mobile devices. The
> available java libraires are greatly restricted - I have lang.string
> and lang.character to choose from (that relate to this problem). In
> addition to the 30K codebase limit, which i have reached - seriously, I
> am like 2 bytes off the maximum.
>
> this is the only part of the code where I have to recognize individual
> characters. everything else is just read a string and output it to the
> screen, which works fine for utf8, cos its null terminated.
But you haven't really answered my question. I'll try again:
Are you saying that your iAppli doesn't support byte[] arrays ? I find that
impossible to believe.
Are you handling your UTF-8 data as binary (in byte[] arrays) or are you
somehow stuffing UTF-8 encoded data into Java Strings ? If the latter then
(a) why ? and (b) how ?
When you read your data in, why don't you use the Java-provided stuff to decode
the UTF-8 into native (decoded) Java Strings ? I could understand that you
might want to stick with UTF-8 encoded data for space reasons, but then it
doesn't make sense that you'd put that data into Strings (16 bits per
character), which would double the space requirement over byte[] arrays for the
same data. (Unless you stuffed two bytes into each Java char -- which would be
downright perverse
Maybe this implementation lacks the character encoding stuff found everwhere in
real Java ? If not then why are you not using it ? If it does, then I suspect
you are hosed.
-- chris