Post not appear on group "comp.lang.java.programmer"

L

Lew

Amit said:
Thanks for your reply...

Yes applet is showing Hindi Font
and when I try out.println(\u0921) it showing on JSP.

That is not a valid Java expression, unless "\u0921" happens to be a variable
identifier.
 
A

Andrew Thompson

Amit Jain wrote:
...
Yes applet is showing Hindi Font
and when I try out.println(\u0921) it showing on JSP.

JSP is really HTML (in the browser).
That means there is some problem in property file...

I do not believe the symptoms point to that.

Can you produce the Hindi characters in a plain old
HTML file/web page? If you can, write that *exact*
text from the JSP, and it should show in the browser
as Hindi.

I suspect the trick is is to use HTML meta tags to
specify the language of the document (web page),
but am a bit hazy on the details.

(Note that the current subject is not best suited
to getting the attention of the people who can help,
but then, HTML questions are best sorted on
comp.infosystems.authoring.html*, in any case.)

* Which is not accessible from the WITUN I
mentioned earlier.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200708/1
 
A

Amit Jain

Thanks for Reply,

I want to implement Localization and Internationalization on web page.
For this purpose I use .properties file and ResourceBundle.
My JSP page showing German, France and other language properly using
properties file but not Hindi text.

..properties file are as follow :->

MessagesBundle_de_DE.properties
greetings = Hallo.
farewell = Tschüß.
inquiry = Wie geht's?

MessagesBundle_fr_FR.properties
greetings = Bonjour.
farewell = Au revoir.
inquiry = Comment allez-vous?

MessagesBundle_hi_IN.properties
greetings =
farewell =
inquiry = !

and JSP :->

<div style="display:block; position:absolute; width:500px;
height:500px; background:#FFCCCC; left: 234px; top: 49px;">
<%
try{
String language;
String country;
language = new String("hi");
country = new String("IN");

Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale(language, country);
messages =
ResourceBundle.getBundle("MessagesBundle",currentLocale);
out.println(messages.getString("greetings"));
out.println(messages.getString("inquiry"));
out.println(messages.getString("farewell"));
}catch(Exception ex){
System.out.println("***exception***:-> "+ex);
}
%>
</div>

Thanks...
 
L

Lew

Amit said:
Thanks for Reply,

I want to implement Localization and Internationalization on web page.
For this purpose I use .properties file and ResourceBundle.
My JSP page showing German, France and other language properly using
properties file but not Hindi text.

..properties file are as follow :->

MessagesBundle_de_DE.properties
greetings = Hallo.
farewell = Tschüß.
inquiry = Wie geht's?

MessagesBundle_fr_FR.properties
greetings = Bonjour.
farewell = Au revoir.
inquiry = Comment allez-vous?

MessagesBundle_hi_IN.properties
greetings =
farewell =
inquiry = !

and JSP :->

<div style="display:block; position:absolute; width:500px;
height:500px; background:#FFCCCC; left: 234px; top: 49px;">
<%
try{
String language;
String country;
language = new String("hi");
country = new String("IN");

Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale(language, country);
messages =
ResourceBundle.getBundle("MessagesBundle",currentLocale);
out.println(messages.getString("greetings"));
out.println(messages.getString("inquiry"));
out.println(messages.getString("farewell"));
}catch(Exception ex){
System.out.println("***exception***:-> "+ex);
}
%>
</div>

If you're already in a JSP, you don't need scriptlet to emit text. At worst,
since you're using scriptlet instead of tag libraries like JSF (Java Server
Faces), you would output text as

<%= messages.getString( "greetings" ) %>

Really modern style guides and mavens like Marty Hall excoriate any use of
scriptlet in JSP. (Or layout or other markup in .java servlets.)
 
M

Manish Pandit

<%
try{
String language;
String country;
language = new String("hi");
country = new String("IN");

Locale currentLocale;
ResourceBundle messages;
currentLocale = new Locale(language, country);
messages =
ResourceBundle.getBundle("MessagesBundle",currentLocale);
out.println(messages.getString("greetings"));
out.println(messages.getString("inquiry"));
out.println(messages.getString("farewell"));
}catch(Exception ex){
System.out.println("***exception***:-> "+ex);
}
%>
</div>

Thanks...

One option you can try is to use database as your bundle. European
text is easy to store on a file system as ISO 8859-1, but for unicode,
you are better off using a database like MySQL. To give you an
example, I went to hi.wikipedia.org. I pasted the word
" " (which is hindi for 'devnagri') from there on to wordpad,
saved it as text, and the text file did not contain unicode, nor it
contained any devnagri.

It worked on MySQL, where I used a JSP to submit it to a Java Servlet,
which added this word to a column, and I read it back on the next
page.

On a side note, try to avoid using scriptlets in JSPs. Use Custom Tag
Libraries, or Struts TL/JSTL/EL instead. They are amazingly easy to
use and are pretty powerful in functionality. In fact, Struts has
built in support for resource bundles (message bundles) which can
handle arguments as well. For example - <%
out.println(messages.getString("greetings")); %> can be replaced with

<bean:message key="greetings" bundle="resourcebundle"/>

Where resourcebundle is the resource name you configure in struts.

-cheers,
Manish
 
L

Lew

Manish said:
One option you can try is to use database as your bundle. European
text is easy to store on a file system as ISO 8859-1, but for unicode,
you are better off using a database like MySQL. To give you an

Ooh - better off using MySQL. I'm not so sure about that. You might want to
use a real database, like PostgreSQL or Oracle Express or Derby.
On a side note, try to avoid using scriptlets in JSPs. Use Custom Tag
Libraries, or Struts TL/JSTL/EL instead. They are amazingly easy to
Absolutely!

use and are pretty powerful in functionality. In fact, Struts has
built in support for resource bundles (message bundles) which can
handle arguments as well. For example - <%
out.println(messages.getString("greetings")); %> can be replaced with

<bean:message key="greetings" bundle="resourcebundle"/>

I wouldn't recommend using Struts "bean" taglib. Use JSF or JSTL for such things.

JSTL has the "<fmt:message>" tag.
<http://java.sun.com/javaee/5/docs/tutorial/doc/JSTL6.html#wp70047>

JSF has nice resource bundle support also.

Also, the bean taglib is from Struts 1.x. Struts 2.0.9 is the current
version. The current version doesn't have "<bean:message>", probably because
JSTL and JSF have stolen its thunder.
 
R

Roedy Green

JSP is really HTML (in the browser).

What happens when you do a "view source" in the page sent to the
browser?

You should see ड and the like for the Hindi characters.

Alternatively you should see
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
and the Hindi chars should be multi-byte encoded. You can check if
they are correct by viewing the file with something that understands
UTF-8 encoding, e.g. notepad.

You need to specify a default font in your CSS body style that
supports Hindi.
 
T

Twisted

yes I am subscribed user for Google Groups otherwise I am not able to
post any other message also.

Does anyone else find it odd that he posted the original post from his
GG account, and then replies to replies to that post from his GG
account, all the while complaining that his posts from GG to cljp
aren't appearing? It would be rather odd if he didn't see his own
posts but did see the replies, or if he didn't see the replies but did
nonetheless post replies to those replies ... :)
 
T

Twisted

Ooh - better off using MySQL. I'm not so sure about that. You might want to
use a real database, like PostgreSQL or Oracle Express or Derby.

This is exceedingly strange. You pooh-pooh a free solution and proceed
to suggest three proprietary and very expensive ones that J. Random
Java Hobbyist can surely not afford.

The obvious thing for someone with no vested interest to do is to
suggest the free solution and pooh-pooh the expensive ones. Which cup
of coffee will I want? The decent $1 cuppa at Tim's or the ludicrously
expensive fancy-pants flavor of the week from Starbucks? You do the
math.

OTOH, the obvious thing for someone who does have a vested interest to
do is to pooh-pooh the free solution and all of the competing
proprietary ones and recommend only the specific proprietary one that
they make money off.

It looks like we're witnessing a phenomenon whereby Big Business is
being supported in the abstract, for its own sake, irrespective of
corporate rivalries. I've seen a few other things in the last year or
so that point to a general low level push by a subset of the
population to persuade people that free/cheap/commodity is bad and
brand-name/expensive/whatever is good without peddling specific
brands. In other words, not one brand advertising that brand but a
whole industry apparently self-promoting in a cooperative way.
Oligopolistic behavior?

Other examples include the subtle but discernible and quite systematic
way that over the last couple of decades social mores have been
modified to make it impossible to date without spending money on a
wide variety of different product categories. It's just not possible
to date on a budget -- to have a dating life requires budgeting at
least a couple hundred a month on having it, comparable to car
insurance or winter heating costs and four times a typical monthly
phone bill with mild to moderate long distance or cellular usage;
closer to eight times a monthly home-broadband-internet bill. This is
obviously gratuitous -- it ought to be possible to meet people and get
together simply by walking into town and going to public parks or main
street or such areas and then get to know them. But it isn't, or
doesn't work, versus using venues you have to pay to use (e.g. bars,
clubs as in nightclubs, or clubs as in interest groups or whatever
with membership fees, or similarly) and spending money on a variety of
consumables (mainly assorted cosmetics, for women, and various things
for men, and sizable quantities of ethanol-laced beverages). Somehow
it's gotten arranged -- the fix is in. But however it was done seems
very subtle, perhaps very indirect manipulation or even self-
organizing somehow. A pareto-nonoptimal Nash equilibrium? Even then
that can be a symptom of a rigged game. Who benefits? A whole slew of
large industries, notably the alcoholic-beverage and the fragrance/
cosmetics industries. Even rivals' ads have in common the message that
to have a social life you need their product, and it seems that that
sort of thing becomes self-fulfilling, as everyone expects their date
to have similar products. Those industries get to write their own
tickets! Oh, and there's the other thing that tends to be needed -- a
car. Not having a car is basically immediate disqualification. Having
a car is of course expensive. The car is expensive. Insurance is
expensive. Fuel is expensive, and getting more so.

In the software industry case it seems like an organized FUD campaign
against FOSS, probably spearheaded by Microsoft, but probably a lot of
the BS, including that in the post I'm replying to, is simply the
result of saturation advertising by proprietary software companies
whose ads consistently position one commercial product above the
others, but all commercial products above FOSS products. The old
tactic of the Big Lie once again, until people start believing it.
Believing they get what they pay for, even though they sooner or later
start wondering why commercial products tend to be slower, more
bloated, buggier, and more ridden with security holes, with poorer
support and less response in particular to security problems --
sitting on exploit reports and doing nothing, or stonewalling when an
exploit is in the wild, rather than *doing* something to fix things.
This is what the Microsofts and other proprietary software companies
of the world position as being superior to FOSS. And people buy it
hook, line, and sinker. Why? Apparently because the price tag makes
them incorrectly jump to the conclusion that since it sells for more,
it must be worth that much more. When it's really just priced that
high because of artificial scarcity and the ability to arbitrarily set
prices without much force-feedback from the market.

A third example is the tendency of the physical infrastructure of our
towns and cities to be designed to be hostile to pedestrians and,
especially, to cyclists. No doubt Big Auto, Big Steel, and especially
Big Oil are to thank here, although it's probably more a matter of
campaign funding and bribing zoning regulators and the like than
public advertising with consistent elements this time. Putting in
sidewalks and especially usable benches presumably gets you an
immediate 50% reduction in your future campaign donations from big
businesses. Local merchants whose shops benefit from foot traffic can
pay only a fraction as much to support putting these in as the big
oil, steel, and car companies can to support not doing so, or even
destroying pre-existing ones as an "unfortunate side effect" of some
urban renewal project or another.

In all of these cases, Joe Consumer, and especially people in lower
income brackets, and generally the majority of the population, are
made worse off to enrich just a few, and yet somehow are prevented
from just saying "No!" and using their collective market and voting
power to make that "No!" carry some weight. Because of a fourth trend
-- isolating people from one another and preventing them from forming
true communities of ordinary-joes, while bombarding them with
commercially-motivated messages (advertising, and subtler stuff in the
mainstream media). No wonder people spend a lot, overeat, and do all
kinds of other stuff trying to fill some sort of void or another but
never feeling happy. There's also the whole "rat-race" thing -- having
to kiss ass and suck up and schmooze your way up some corporate
ladder, pulling double-overtime three nights a week and working every
other weekend, just to not get sacked in the next round of layoffs,
nevermind to get an actual promotion. Something's distorted the labor
market so that it has 11%+ unemployment but those that are employed
are *over*employed, and often in work they're overqualified for. Full
employment with four-day/64-hour workweeks would be much more even
distribution, so why doesn't the market trend in that direction? Again
it must involve unequal bargaining power, with employers (=
corporations) too powerful and able to distort the labor market to
their own advantage (cheap labor kept obsequious by fear of job loss).

Of course, I've no idea how to fix any of this. Communism is something
that keeps being tried and keeps failing for various reasons. It's
clearly not the answer. A proper, truly competitive market with more
equal bargaining power between markets and the businesses that serve
them would seem to be desirable, but it's hard to see how to cause it
to exist. Striking down laws that promote artificial scarcity
(copyright and patent) would be a start. Most likely, the Internet
will play a key role in enabling the formation of communities to occur
again. Fuel shortages/price increases and climate change might help
too, bad though such things initially seem, as people seek to scrimp
and worry about global warming and so avoid as much car travel, use
buses, and generally meet random people in their neighborhoods and
towns once again as a result. Mass consumer backlashes against ever-
more-expensive and frivolous "lifestyle consumables" like perfumes and
razor blades might be another one, or a steady encroachment of cheap
commodities from below -- commodity computing hardware happened in my
lifetime, and commodity software is on the rise in FOSS; commodity
generic fragrances and cheap razor blades compatible with common
razors can't be far behind. There's lots of room for various companies
to grab the low end of the market from the traditional robber barons
in various industries, and if some of them don't join the dark side
and become part of the same oligopoly they started off by challenging,
we'll see some changes.

But I digress...
 
T

Twisted

I presume you are using Google which is an indirect (and Mickey Mouse)
way to access the newsgroups. Try getting a dedicated newsreader.

If the OP is using google groups, it's probably because their ISP
doesn't provide a free "real" newsserver for them to use with a "real"
newsreader. Because given the choice between the two, I know which I'd
prefer...
 
L

Lew

Twisted said:
This is exceedingly strange. You pooh-pooh a free solution and proceed
to suggest three proprietary and very expensive ones that J. Random
Java Hobbyist can surely not afford.

PostgreSQL is free and open source.
<http://www.postgresql.org/>
Oracle Express is free to develop, deploy and distribute.
<http://www.oracle.com/technology/products/database/xe/index.html>
Derby is free and open source.
,http://db.apache.org/derby/>

I really have no idea why you think that constitutes "pooh-pooh[ing] a free
solution" or why you think that free, open source products are "proprietary
and very expensive".

If Joe Hobbyist cannot afford free, he's truly desperate.
 
L

Lothar Kimmeringer

Amit said:
MessagesBundle_de_DE.properties
greetings = Hallo.
farewell = Tschüß.
inquiry = Wie geht's?

That's one effect with posting via Google. The content-type
is claimed to be ASCII, but it isn't.
MessagesBundle_hi_IN.properties
greetings =
farewell =
inquiry = !

I only see spaces here. If you do a
type MessagesBundle_hi_IN.properties
on Windows or a
cat MessagesBundle_hi_IN.properties
on a unixoid system. What is printed on the console?
If native2ascii worked correctly there should be a lot
of lines looking like this:
greetings = \uxxxx\uyyyy\uzzzz...
language = new String("hi");
country = new String("IN");

a
language = "hi";
country = "IN";
is OK as well. No need to create instances and instances
of Strings.
out.println(messages.getString("greetings"));

To see what's transfered, can you do a
out.println(URLEncoder.encode(messages.getString("greetings"), "UTF8"));
to be able to see what's received from the bundle?


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
L

Lothar Kimmeringer

Twisted said:
Does anyone else find it odd that he posted the original post from his
GG account, and then replies to replies to that post from his GG
account, all the while complaining that his posts from GG to cljp
aren't appearing?

But there seems to be some kind of problem:

http://groups.google.de/groups?as_uauthors=<[email protected]>

But with
http://groups.google.de/group/comp....10669dcad66/91cb4601f8ca662a#91cb4601f8ca662a
you can see this thread completely. If you go to the "Profile"
of him (next to his name) you can see, that he was posting 24
articles in august, but as soon as you click on the link, you
see no results at all.


Regards, Lothar
--
Lothar Kimmeringer E-Mail: (e-mail address removed)
PGP-encrypted mails preferred (Key-ID: 0x8BC3CD81)

Always remember: The answer is forty-two, there can only be wrong
questions!
 
N

nebulous99

PostgreSQL is free and open source.

Really? The name's usually come up in a commercial context.
Oracle Express is free to develop, deploy and distribute.

That one is definitely proprietary, although Oracle has been known to
dabble in FOSS offerings from time to time (including a Red Hat clone
IIRC). I doubt it's actually open source, and the "Express" in the
name makes me thing "*Crutches not included" in small print on the box
somewhere. :p
Derby is free and open source.

I'd never heard of that one. But the usual pattern is that when
someone pooh-poohs a freebie and drops a well-known corporation's name
(e.g. Oracle) they are pushing people at pay solutions for one reason
or another.

Of course, if it's free and open source and I've never heard of it,
it's obscure, and that makes me wonder why it's obscure whereas e.g.
MySQL is not obscure. A lot of the times, obscure means sucks,
although it can simply mean new. Of course, with software, new usually
means sucks. :)

(The reverse correspondence doesn't hold. Sucks doesn't mean obscure;
just ask any Windoze user. Commercial software that sucks is often not
obscure because the company selling it makes up for its shortcomings
on selling itself by quality and word of mouth by hyping it with
massive ad campaigns and the odd press release (= thinly-veiled ad).
Obscurity and quality tend to correlate better both ways with open
source, especially for established projects, because open source tends
to get promoted primarily via meritocratic methods such as word-of-
mouth.)
 
L

Lew

I'd never heard of that one. But the usual pattern is that when
someone pooh-poohs a freebie and drops a well-known corporation's name

Far from "pooh-poohing" freebies, I suggested three.
(e.g. Oracle) they are pushing people at pay solutions for one reason
or another.

The danger with generalizations is that they might not apply.

There is an advantage to a comp.lang.java.programmer to be familiar with
Oracle, since it's a major source of employment, thus it serves this community
for me to mention it. Since Express Edition is free, I'm not promoting
anything costly.
Of course, if [Derby]'s free and open source and I've never heard of it,
it's obscure, and that makes me wonder why it's obscure whereas e.g.
MySQL is not obscure. A lot of the times, obscure means sucks,
although it can simply mean new. Of course, with software, new usually
means sucks. :)

Apache Derby is far from obscure. It's included in a number of products, such
as NetBeans, and pretty darn widespread. Check out their website, referenced
upthread.

Part of why I mentioned it in the first place, along with PostgreSQL and
Oracle's free offering, was to inform folks of alternatives they might not
have considered.

So if you haven't heard of it before, and now thanks to me you have, you're
welcome.
 
N

nebulous99

Far from "pooh-poohing" freebies, I suggested three.

And pooh-poohed one.
The danger with generalizations is that they might not apply.

You know what? Just stop it. Stop lecturing me. Stop trying to prove
to me, the world, or yourself how inadequate I supposedly am. Stop
net.stalking me by purposely checking newsgroups every 2 minutes to
post more of this shit that forces me to respond in my own defense.
I'm tired, and I want to go to bed, and I want to do it without
leaving some nasty flame or implied insult festering away with hours
in which to influence other peoples' minds before I get around to
defusing it. What the hell do you want from me, anyway? Why are you
doing this? Why not just shut the hell up and stick to discussing
Java?
There is an advantage to a comp.lang.java.programmer to be familiar with
Oracle, since it's a major source of employment, thus it serves this community
for me to mention it. Since Express Edition is free, I'm not promoting
anything costly.

That's very clever dissembling this time. I think you're getting
better at it.
Of course, the fact is what you're promoting is no doubt more an
interactive advertisement than fully usable software -- things named
"express edition" with expensive "regular" and/or "pro" editions
almost always are. Which means you're indirectly promoting the
expensive version that people will be forced to migrate to when they
get dependent in some way on the crippled version and then something
makes it hard to stay with that or to back out and use e.g. MySQL
instead -- such as it gratuitously not exporting easily to commodity
formats and time-bombing, failing to scale up past a certain point, or
otherwise exhibiting a gratuitous limitation that not only would it
not have cost them anything to have avoided or made much more
generous, but it probably actually cost them extra time and effort to
put the limitation there in the first place.

I know -- I've seen this sort of thing before with all kinds of
"express" or "light" or "free" or "home" or "starter" editions of
things, either free or cheap. Windows XP home and Vista's "starter
edition" are Microsoft examples (one has gratuitous crippling that
affects any attempt to use the machine to its full hardware capacity
as a server in almost any role; made worse with service pack 2; the
other has gratuitous limits on multitasking of all things; neither are
free or really even cheap but they are certainly inexpensive
*relative* to the corresponding "pro" versions). And I could list more
examples all night.
Apache Derby is far from obscure. It's included in a number of products, such
as NetBeans, and pretty darn widespread. Check out their website, referenced
upthread.

Apache isn't obscure, but I've never heard this Derby mentioned at all
before, even though I've heard both MySQL and PostgreSQL mentioned
plenty of times, and Oracle database products of course. It sounds as
if Derby is shipped as an under-the-hood component in prepackaged
solutions much more commonly than it's shipped as a stand-alone
product in its own right.

You probably know the make of your car. Do you know which steel
company provided the bulk of its structural steel? I doubt it. Do very
many people directly buy steel from that company, compared to buying
cars from manufacturers that use that brand of steel in their
construction? Probably not. More extreme example, but still.
 
S

Sherm Pendley

Twisted said:
This is exceedingly strange. You pooh-pooh a free solution and proceed
to suggest three proprietary and very expensive ones that J. Random
Java Hobbyist can surely not afford.

None of those cost a dime, and only one of them is proprietary.

PostgreSQL is BSD licensed.

<http://www.postgresql.org/>

Derby is also open source, under the Apache license:

<http://db.apache.org/derby/>

Oracle Express is proprietary, but it's a free download.

<http://www.oracle.com/technology/products/database/xe/index.html>

What I thought was quite strange was that Lew *didn't* pooh-pooh the idea
that a database is somehow better suited for storing Unicode text than a
filesystem. While it's true that old-school POSIX functions like fread()
just give you a bag of bytes, most programmers these days are using higher
level tools that do understand text encoding.

sherm--
 
A

Amit Jain

Thanks for reply,

I am also using MySql database for storing hindi text
but I also want to store some of Hindi text in properties file.

For Example Login page, Login page contain User Name and Password so
I want to display user name and password in Hindi when user select
Hindi Language using
..properties file and Resource Bundle.

For doing above task (login page Internationalization), Is my steps
are wright or wrong ?

Thanks
Amit Jain
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top