0.307 don't support Chinese file name
Moderator: Moderators
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
This is very interesting. I wasn't aware DC++ was unicode compliant, or else is this just a special Chinese font that has these characters matching up with standard ASCII numbers?
What can I do to my Windows 2000 SP4 installation to see this language in the hub you mentioned in your signature. Or does this require a special version of windows?
What can I do to my Windows 2000 SP4 installation to see this language in the hub you mentioned in your signature. Or does this require a special version of windows?
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
I've set my Regional Settings from the control panel to be configured to read and write Traditional Chinese, and then had to as well set that as Default. Everything still appears normal to me; however things which should be displayed as Chinese now appear!
In version 0.307, I can connect to your hub and view all of those characters all around the DC++ client and in file list views both in the tree list (left) and the regular list (right). This occurs for file lists I obtain from people who list 0.251, 0.305, and 0.306 in their description. (As well as you who claim 0.365special.) But indeed something is different with 0.307, however it only happens for the regular list (right).
I'll try to look into this right now to see if I might be able to help you. However it probably should be said that because DC++ is not fully Unicode compliant, you can't expect to be able to see everything correctly.
A webpage can be found here detailing with pictures.
In version 0.307, I can connect to your hub and view all of those characters all around the DC++ client and in file list views both in the tree list (left) and the regular list (right). This occurs for file lists I obtain from people who list 0.251, 0.305, and 0.306 in their description. (As well as you who claim 0.365special.) But indeed something is different with 0.307, however it only happens for the regular list (right).
I'll try to look into this right now to see if I might be able to help you. However it probably should be said that because DC++ is not fully Unicode compliant, you can't expect to be able to see everything correctly.
A webpage can be found here detailing with pictures.
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
Regarding posts: Now is this a problem relating to the timestamp problems that seem to keep recurring on this forum? I didn't get to see your suggestion until a little bit after I posted my solution. [ADSL][CN_FZ]fenxiang, where you able to see my post saying that I will now personally look into your problem?
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
-
- Forum Moderator
- Posts: 1420
- Joined: 2003-04-22 14:37
Something I forgot to mention when I explained what I did to at least be able to see this problem. Changing my regional settings as I did caused some part of my antivirus software to crash. I recall it occurring at each reboot, and so I wouldn't suggest you doing the same if you use this antivirus:
Mcafee build 8.0.26 engine 4.3.20
Mcafee build 8.0.26 engine 4.3.20
My Visual Studio .NET 2003 is licensed under my name, and the same for my operating system... What about you?
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
I surf on an OC3 without limitations, two to be exact, and I'm not joking.
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
I imagine that Sourceforge has some wicked clock skew on the project servers... that would explain the recent problems of out of order posts and the "you cannot make a post so quickly after your last post" type-messages.Qbert wrote:Regarding posts: Now is this a problem relating to the timestamp problems that seem to keep recurring on this forum?
Code: Select all
-- 0.307 2004-03-10 --
* XML File lists that contain hashes if available, and support full utf-8 names (correct viewing is not guaranteed, but download should work)
-
- The Creator Himself
- Posts: 296
- Joined: 2003-01-02 17:15
-
- Forum Moderator
- Posts: 587
- Joined: 2003-05-07 02:38
- Location: Sweden, Linkoping
-
- The Creator Himself
- Posts: 296
- Joined: 2003-01-02 17:15
Actually, I'm swedish, not english...[ADSL][CN_FZ]fenxiang wrote:First, thanks for all the developer's great job, I like DC++ very much.
But in version DC++0.401 , Chinese files name problem still exist.
download files list between the user that using behind version DC++0.306, all Chinese files name are not displayed. It means one is zero sharing to the other, even if he is sharing a lot of files.
I don't think deverlopers did pay enough attention to this problem, almost all they are thinking about is the users who are using english.
Now that , In Chinese version of operting system: behind version 0.163, DC++ doesn't scroll automatically in the main chat. behind version 0.306 DC++ doesn't dispaly Chinese files name............. it make us keep away from using the new version dc++
0.401 prolem pic:
http://www.freewebs.com/dcppver/dcplusplusbug401.gif
Anyhow, the problem is that I don't have any double-byte locale available on my computer so it's pretty impossible for me to test that kind of configuration...I did some updates to the translation code, but it seems like they were not enough...
If you want to help out, drop by surfnet.mine.nu:1416 and see if I or gargoylemt's in...
As a side note, the whole point of the new file lists is to make dc++ more interational (by using unicode instead of whatever codepage the user currently is using), so that even people who are not running a chinese os potentially will have the correct filenames available - right now if someone with a...say...greek computer downloads your filelist he'll see a bunch of strange characters that make no sense - in the future he'll be able to see a bunch of correct chinese characters (in my case they will still make no sense, but they're pretty at least =)
If you search for the names of these files, they will appear in the search window. Some of the characters show up correctly, and some don't. (I'm experiencing the same thing with Japanese characters btw).
But when you click download in the search results, and start to download the file, you get a 'file not shared' error message. This is really crippling us Asian users
But when you click download in the search results, and start to download the file, you get a 'file not shared' error message. This is really crippling us Asian users
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
The new ADC protocol core should be (ultimately) unicode friendly. If anyone wants to chip in with development, they're quite welcome to... Since you have a vested interest in it, you'll handle it better than those of us whose locales already work with DC++.RanmaJP wrote:But when you click download in the search results, and start to download the file, you get a 'file not shared' error message. This is really crippling us Asian users
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Util.cpp Line: 347
Should be
see also
Code: Select all
static void cToUtf8(wchar_t c, string& str) {
if(c >= 0x0800) {
str += (char)(0x80 | 0x40 | 0x20 & (c >> 12));
str += (char)(0x80 & ((c >> 6) & 0x3f));
str += (char)(0x80 & (c & 0x3f));
} else if(c >= 0x0080) {
str += (char)(0x80 | 0x40 | (c >> 6));
str += (char)(0x80 | (c & 0x3f));
} else {
str += (char)c;
}
}
Should be
Code: Select all
static void cToUtf8(wchar_t c, string& str) {
if(c >= 0x0800) {
str += (char)(0x80 | 0x40 | 0x20 | (c >> 12));
str += (char)(0x80 | ((c >> 6) & 0x3f));
str += (char)(0x80 | (c & 0x3f));
} else if(c >= 0x0080) {
str += (char)(0x80 | 0x40 | (c >> 6));
str += (char)(0x80 | (c & 0x3f));
} else {
str += (char)c;
}
}
see also
Code: Select all
Char. number range | UTF-8 octet sequence
(hexadecimal) | (binary)
--------------------+---------------------------------------------
0000 0000-0000 007F | 0xxxxxxx
0000 0080-0000 07FF | 110xxxxx 10xxxxxx
0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx
0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
Util.cpp Line 360
should be
Code: Select all
static int utf8ToC(const char* str, wchar_t& c) {
int l = 0;
if(str[0] & 0x80) {
if(str[0] & 0x40) {
if(str[0] & 0x20) {
if(str[1] == 0 || str[2] ||
Code: Select all
static int utf8ToC(const char* str, wchar_t& c) {
int l = 0;
if(str[0] & 0x80) {
if(str[0] & 0x40) {
if(str[0] & 0x20) {
if(str[1] == 0 || str[2] == 0||
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
As you said in the hub, you load the XML list in your browser, then force it over to GB2312. So your file list isn't in unicode at all, is it? Liny's patch just make sure that your GB2312 encoded file list isn't made unreadable by the unicode translation in DC++.
Liny, I took the liberty of making your patch into a unified diff and submitting it to arne with credit to you.
Liny, I took the liberty of making your patch into a unified diff and submitting it to arne with credit to you.
-
- Forum Moderator
- Posts: 366
- Joined: 2004-03-06 02:46
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Oh, excellent. Nevermind my earlier complaint, in that case.[ADSL][CN_FZ]fenxiang wrote:Sorry, I made a mistake. XML list opened with ie, the only encoding is "unicode", I can not force it to GB2312. (in pic: http://fenxiang.3322.net/temp/filenameutf8.htm )
I opened the list with "EmEditor" and find it's encoding is UTF-8.
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
Which seems to be this bug: http://sourceforge.net/tracker/index.ph ... tid=427632[ADSL][CN_FZ]fenxiang wrote:
hehe, the next problem waiting to be solved is auto scrolling in the mainchat, like the way it scrolls in "private chat".
Maybe it can be solved through better/different font metrics, or it may require more unicode awareness.
but now your window will always scroll, even when you're reading some page of previously written chat, and that is not desired behaviour
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
-
- Posts: 6
- Joined: 2004-08-02 23:36
ye,i had looked over the addline function in hubframe.cpp,and found that ctrlClient.PosFromChar always returns P(-1,-1),that's why r.PtInRect(p) is always false.I suppose the problem is the asian character.[ADSL][CN_FZ]fenxiang wrote:
hehe, the next problem waiting to be solved is auto scrolling in the mainchat, like the way it scrolls in "private chat".
GetWindowTextLength() which regards one asian character as two.
but PosFromChar only regard it as one.
So GetWindowTextLength()-1 is much greater than the index of the last character,that's where P(-1,-1) comes from.
then i tried another method which is written below
the code in addline function
Code: Select all
POINT p = ctrlClient.PosFromChar(ctrlClient.GetWindowTextLength()-1);
CRect r;
ctrlClient.GetClientRect(r);
if( r.PtInRect(p) || MDIGetActive() != m_hWnd)
noscroll = FALSE;
else {
ctrlClient.SetRedraw(FALSE); // Strange!! This disables the scrolling...????
}
Code: Select all
int max,cur,page;
SCROLLINFO info;
info.cbSize=sizeof(info);
info.fMask=SIF_ALL;
ctrlClient.GetScrollInfo(SB_VERT,&info);
max=info.nMax;
cur=info.nPos;
page=info.nPage;
if(cur+page>max || MDIGetActive() != m_hWnd)
noscroll=FALSE;
else
ctrlClient.SetRedraw(FALSE); // Strange!! This disables the scrolling...????
If the scrollbar is attached to the bottom,it will scroll when new line comes.
If not,it will not scroll!
So it obtains the same effect as the former code,but doesn't cause code problem.
IIRC, cur+page didn't always work correctly, so in BCDC++ we used:
Code: Select all
bool HubFrame::scrollbarAtBottom() {
if(::IsWindow(ctrlClient.m_hWnd)) {
SCROLLBARINFO sbi;
sbi.cbSize = sizeof(SCROLLBARINFO);
SCROLLINFO si;
si.cbSize = sizeof(SCROLLINFO);
si.fMask = SIF_POS | SIF_RANGE | SIF_PAGE;
ctrlClient.GetScrollInfo(SB_VERT, &si);
GetScrollBarInfo(ctrlClient.m_hWnd, OBJID_VSCROLL, &sbi);
if ((sbi.rgstate[0] & STATE_SYSTEM_INVISIBLE) || ((sbi.rcScrollBar.bottom - sbi.rcScrollBar.top) + si.nPos > si.nMax))
return true;
}
return false;
}
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
-
- Posts: 6
- Joined: 2004-08-02 23:36
ye,i tried the function you provided,but failed.Sedulus wrote:IIRC, cur+page didn't always work correctly, so in BCDC++ we used:
the function always returned true.
after debugging,i found that
Code: Select all
(sbi.rcScrollBar.bottom - sbi.rcScrollBar.top) + si.nPos > si.nMax
when the scroll was at the top,i got the data which is listed below
sbi.rcScrollBar.bottom=526
sbi.rcScrollBar.top=77
si.nPos=0
si.nMax=46
i'm confused what rcScrollBar means,for from MSDN rcScrollBar is a
Pointer to a RECT structure that indicates the coordinates of the scroll bar.
What's Wrong
hm.. it could be wrong that you're using the DC++ CEdit and BCDC++ is using the CRichEdit, and that there somehow is some difference in what values those calls return; in which case your solution is fine. if you could test that it works fine under all circumstances, I think arne would gladly accept a patch that makes his code less hackish (3 lines blah blah.. ;)) )
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
-
- Posts: 6
- Joined: 2004-08-02 23:36
hehe, it now is patched by ourselves which is provided at http://fenxiang.3322.net/p2p/
,and tested by many people.
I think the scroll problem is not well solved because of something else.
such as the trouble of scroll position restoring when switching hub window
,and tested by many people.
I think the scroll problem is not well solved because of something else.
such as the trouble of scroll position restoring when switching hub window
yes.. that was a harder nut to crackMelvin0619 wrote:such as the trouble of scroll position restoring when switching hub window
I did this (excerpts from BCDC++ svn 413:414):
Code: Select all
+ MESSAGE_HANDLER(WM_WINDOWPOSCHANGING, onSizeMove)
+ LRESULT onSizeMove(UINT /*uMsg*/, WPARAM wParam, LPARAM lParam, BOOL& bH
andled);
- updateUsers(false), curCommandPosition(0), currentNeedlePos(-1),
+ updateUsers(false), curCommandPosition(0), currentNeedlePos(-1),
rememberAutoscroll(false),
+ bool rememberAutoscroll; // remember if scrollbar was at bottom
- ctrlClient.SendMessage(EM_SCROLL, SB_BOTTOM, 0);
+ if(rememberAutoscroll) {
+ ctrlClient.SendMessage(EM_SCROLL, SB_BOTTOM, 0);
+ rememberAutoscroll = false;
+ }
+LRESULT HubFrame::onSizeMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*
/, BOOL& bHandled) {
+ bHandled = FALSE;
+ if(scrollbarAtBottom())
+ rememberAutoscroll = true;
+ return 0;
+}
+
+LRESULT HubFrame::onSetFocus(UINT /* uMsg */, WPARAM /*wParam*/, LPARAM /*lPara
m*/, BOOL& /*bHandled*/) {
+ // if scrollbar used to be at bottom make sure we scroll the text to the
bottom
+ if(rememberAutoscroll) {
+ ctrlClient.SetSel(-1, -1); // is this needed?
+ ctrlClient.SendMessage(EM_SCROLL, SB_BOTTOM, 0); // is this need
ed?
+ ctrlClient.InvalidateRect(NULL);
+ rememberAutoscroll = false;
+ }
+ ctrlMessage.SetFocus();
+ return 0;
+}
http://dc.selwerd.nl/hublist.xml.bz2
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
http://www.b.ali.btinternet.co.uk/DCPlusPlus/index.html (TheParanoidOne's DC++ Guide)
http://www.dslreports.com/faq/dc (BSOD2600's Direct Connect FAQ)
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us
But isn't that exactly as it's supposed to be? The filename from the remote user is UTF-8 encoded, but your filesystem uses a different locale... ?[ADSL][CN_FZ]fenxiang wrote:suppose(((1)))(((2))) are double-bytes file names. When I open this xml file with notepad, (((1))) displayed good, but (((2))) are strange characters. When I open it with encoding Utf-8, (((2)))looks nice, but (((1))) is in a mess. Yes, may be people who is in single-byte condition are not aware of it, but it looks strange, although it doesn't prevent us from downloading.
Well, that would explain why some user claimed that in the dev hub, but nobody could reproduce it. There could be some assumption that breaks with multi-byte characters - when you run it under a debugger, what looks to be the cause?[ADSL][CN_FZ]fenxiang wrote:In BCDC++, when there is any double-bytes character appears in the main chat, if we select something including these chacters, then right click, right click again, BCDC++ crash down.... This proble appears in the newest version of BCDC++0.403b-svn497, and no this problem with english characters only condition, and no problem in private chat.
PPK doesn't post here much, so I'm not sure if anyone can help you. I know I don't use CZDC.[ADSL][CN_FZ]fenxiang wrote:In CZDC++, after using language file, Settings -> CZDC++ -> Toolbar, all the items' names are strange characters.
-
- Posts: 6
- Joined: 2004-08-02 23:36
yeah,this check do make sure the scrollbar is at the bottom if it was.Sedulus wrote:yes.. that was a harder nut to crackMelvin0619 wrote:such as the trouble of scroll position restoring when switching hub window
I did this (excerpts from BCDC++ svn 413:414):
but how about the position which is 10 pixels far from the bottom,the problem still reappears.
i think proportion may be a useful method!
but i have not tried it yet
-
- Posts: 6
- Joined: 2004-08-02 23:36
hehe,i try the proportion idea,and it is really valid.
here is my code
scrollproportion,which is float type, is the member of Hubframe
sorry for the code redundancy
practically it does solved the problem,you can try it
here is my code
Code: Select all
LRESULT onSetFocus(UINT /* uMsg */, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
int max,cur,page;
SCROLLINFO info;
info.cbSize=sizeof(info);
info.fMask=SIF_ALL;
ctrlClient.GetScrollInfo(SB_VERT,&info);
max=info.nMax;
page=info.nPage;
if(scrollproportion>=1)
cur=max;
else
{
cur=(int)(max*scrollproportion-page);
if(cur>max) cur=max;
if(cur<0) cur=0;
}
ctrlClient.SetScrollPos(SB_VERT,cur);
ctrlMessage.SetFocus();
return 0;
}
LRESULT HubFrame::onSizeMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) {
bHandled = FALSE;
int max,cur,page;
SCROLLINFO info;
info.cbSize=sizeof(info);
info.fMask=SIF_ALL;
ctrlClient.GetScrollInfo(SB_VERT,&info);
max=info.nMax;
cur=info.nPos;
page=info.nPage;
if(max)
scrollproportion=((float)cur+(float)page)/(float)max;
else
scrollproportion=0.0;
return 0;
}
sorry for the code redundancy
practically it does solved the problem,you can try it
-
- Posts: 6
- Joined: 2004-08-02 23:36
likewise
i add
to the addline function.
m_AutoScrollLevel ranges from 0.0 to infinite ,which means the autoscroll degree.
if it is 0,it always scroll wherever the scrollbar is.
if it is greater than 0 but smaller than 1,it scrolls in the light of the scrollbar position proportion.
if it is 1,it scroll when the scrollbar is at the bottom.
and if it is greater than 1,it never scrolls.
here i omit the condition that it is smaller than 0
so our users can set the data as they want,even though it maybe meaningless
now i set it as 1.0
i add
Code: Select all
proportion=((float)cur+(float)page)/(float)max;
if(proportion>=m_AutoScrollLevel || MDIGetActive() != m_hWnd)
m_AutoScrollLevel ranges from 0.0 to infinite ,which means the autoscroll degree.
if it is 0,it always scroll wherever the scrollbar is.
if it is greater than 0 but smaller than 1,it scrolls in the light of the scrollbar position proportion.
if it is 1,it scroll when the scrollbar is at the bottom.
and if it is greater than 1,it never scrolls.
here i omit the condition that it is smaller than 0
so our users can set the data as they want,even though it maybe meaningless
now i set it as 1.0
-
- DC++ Contributor
- Posts: 3212
- Joined: 2003-01-07 21:46
- Location: .pa.us