hi, Wim and all:

sorry to my before review "so, this situation, wt does not handle the
corrent href display", everytime some problem came to me, this clause always
became the final result, so be sorry.

And thanks Wim made me learn more about the Char Set and Char Coding
knowledge.

In my server(Ubuntun), "locale -a" gives :

C
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
POSIX
zh_CN.utf8
zh_HK.utf8
zh_SG.utf8
zh_TW.utf8

and locale gives:

LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=

so, I need WString(url, UTF-8), as this, It is succeful~~!
but as you said, for general reason, i need to use WString(url,
std::locale("")), or WString(url, setlocale("")), but after I tested in my
server, std::locale("") or setlocale("") = C, they could not get the server
default locale value(zh_CN.UTF-8), it is so strange, Can you give me some
guide if you have some time :-)

BTW: WAnchor really works , thanks again, I will be use WAnchor for this
app.

Best Regards
Zhimin

2010/7/5 Wim Dumon <[email protected]>

> Hi Zhiming,
>
> What I guess that happens here, is that you're mixing different
> character encodings in one string. The string literals are ASCII -
> that's fine. The description.toUTF8() part causes a mix of ASCII and
> UTF8, that's fine, although you should write WString::fromUTF8()
> around the entire string. I'll assume that description is a WString,
> in that case you don't need to do anything. The url comes directly
> from readdir, so it is probably encoded in whatever encoding your OS
> uses. On Windows, that won't be UTF8. Use an explicit WString
> constructor to construct this part: WString(url, std::locale("")); To
> put it all together:
>
>  return new WText("<a href=\"" + WString(url, std::locale("") + "\"
> TARGET=\"_blank\">" + description + "</a>");
>
> Note: I'd use a WAnchor instead.
>
> Best regards,
> Wim.
>
> 2010/7/4 Zhimin Song <[email protected]>:
> > hi, Dule:
> >
> >  You are right about this situation..and like others earlier discusses.
> but
> > how to deal with the following situation:
> >
> > WText *ComUtil::href(const string &url, const WString &description) {
> >
> >         return new WText("<a href=\"" + url + "\" TARGET=\"_blank\">" +
> > description.toUTF8() + "</a>");
> > }
> >
> > it doesn't work corretly, the "url" is the file address, returned by
> >
> >       return_code = readdir_r(dir, &entry, &res)
> >
> > and
> >
> >       url = addr + entry.d_name
> >
> > so, this situation, wt does not handle the corrent href display..
> >
> > Regards
> > Zhimin
> >
> >
> > 2010/7/3 Dushan Savich <[email protected]>
> >>
> >> Hi  Yu,
> >>
> >> This looks to be more related to compiler than to Wt ...
> >> C++ doesn't always handle Unicode characters nicely.
> >> You should try externalizing strings, at least it always works for me
> :-)
> >>    .
> >> You could try loading  text using  WString::tr( .. )
> >> [ check out the WMessageResourceBundle  -
> >>
> >>
> http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WMessageResourceBundle.html
> >> ] .
> >>
> >>
> >> Cheers,
> >> Dule
> >>
> >>
> >> 2010/7/3 yufeng <[email protected]>:
> >> > hi:
> >> >  I am chinese,I upgrade wt to wt3.1.3 ,There is a problem about WText.
> >> >  In Wt3.1.3 ,why show like this "hello,����������yggh"?In early wt ,Ok
> >> >  here is my code:
> >> >   ....
> >> >   WText* pUserNameText=new WText("hello,你好!欢迎你来三明日报投稿!
> >> > yyyggh",mpHeaderDiv);
> >> >  pUserNameText->setId("WebUser");
> >> >  .....
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> ------------------------------------------------------------------------------
> >> > This SF.net email is sponsored by Sprint
> >> > What will you do first with EVO, the first 4G phone?
> >> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> >> > _______________________________________________
> >> > witty-interest mailing list
> >> > [email protected]
> >> > https://lists.sourceforge.net/lists/listinfo/witty-interest
> >> >
> >>
> >>
> >>
> >> --
> >> Kind Regards,
> >> Dushan Savich
> >> [email protected]
> >> http://stosha.com/
> >> +381 64 329 33 55
> >> Nehruova 95/51
> >> 11070 New Belgrade
> >> Belgrade
> >> Serbia
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> This SF.net email is sponsored by Sprint
> >> What will you do first with EVO, the first 4G phone?
> >> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> >> _______________________________________________
> >> witty-interest mailing list
> >> [email protected]
> >> https://lists.sourceforge.net/lists/listinfo/witty-interest
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by Sprint
> > What will you do first with EVO, the first 4G phone?
> > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> > _______________________________________________
> > witty-interest mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/witty-interest
> >
> >
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to