From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by sourceware.org (Postfix) with ESMTPS id 651ED3858D20 for ; Fri, 29 Mar 2024 04:01:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 651ED3858D20 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSW.ab.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=SystematicSW.ab.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 651ED3858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=216.40.44.13 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711684881; cv=none; b=R2ONlrTrc6Wl/oqztK6yQ9kSwFKGPra0vtJVoSy3Hdp7Vg8LueSKrnw69tgmyjVWCps85HgFjAE5X8Cn6V8Zz3lapsoRDZ6zYLON/60gw98R1tKzGvUMPUMOrUPeKqAWlZ4REKMlaFh+25ikyJhry6yfv19IMrEYOCiJ8zQEAAM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1711684881; c=relaxed/simple; bh=qgdY4SGvQzzHKzjafB5e2dwMiqxOX/lquKk5xTaxH5k=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=qm/h6sUfuZJ25jInfidT6hyu+ZbPhhB2B4FzJFgjxuv69x+i5Jqvc5YeFtTdRAbBrz/KyPPrgIXAIK5eZ07Bi95ex+69/jEMurswl9ZqhSaX/FaXm3JQEbJXjawXrRfSTq0piptIdqlMXp7sSbP/FUaUMhuqAu5FuZatyZyAYQQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from omf02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id E6C0B4106F; Fri, 29 Mar 2024 04:01:18 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: Brian.Inglis@SystematicSW.ab.ca) by omf02.hostedemail.com (Postfix) with ESMTPA id 46A0380009; Fri, 29 Mar 2024 04:01:17 +0000 (UTC) Message-ID: <977c901f-4733-4c17-960c-91b652024bff@SystematicSW.ab.ca> Date: Thu, 28 Mar 2024 22:01:16 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: cygwin@cygwin.com Subject: Re: When displaying Chinese help information in Cygwin setup, the program does not respond. The code enters a dead loop. Content-Language: en-CA To: cygwin@cygwin.com References: Cc: =?UTF-8?B?6LW15Lyf?= From: Brian Inglis Organization: Systematic Software In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Stat-Signature: cihdry8rf4bz3x3gw6aa6tu8nft8ny6m X-Rspamd-Server: rspamout03 X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Rspamd-Queue-Id: 46A0380009 X-Session-Marker: 427269616E2E496E676C69734053797374656D6174696353572E61622E6361 X-Session-ID: U2FsdGVkX1+Pm/k129NQiQpLh9cv/mEoGdtu2PqBVe0= X-HE-Tag: 1711684877-544395 X-HE-Meta: U2FsdGVkX19WfPvSRbni9fC4xM6uNwk+z/th5XXJGGYiuZ3g8ZhDNAjwOz33oLc5gNIW7Rp+XFG9gXEmdz6nx+CSedS1WJ28DqwFAFYh1g7M1gTwWhpheFxlSC6r6dXMR4096uTuiI+xAWP4hm83RXQlaDAhUF2SGyQ5JhBRGsiovq1hKRJMZ+3T6z9zH8VhZCtXMclGyaTm6vwZYROIl/ceY6tcfJhnq8TUu1H/JFzkZ4M2w/G2r52KLSsvcM0V69ZOEj0bxKCbv89iLjIkpVmgHk8sQcVR4fr2J03S3Yt0KlubPuScJOh4lM2qobIwb53ytN/1Laz8BgEsmjGcdQip+0le90oQ X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2024-03-28 09:26, 赵伟 via Cygwin wrote: > When displaying Chinese help information, the program does not respond. > The code enters a dead loop in file > "libgetopt++/include/getopt++/DefaultFormatter.h", > because some Chinese help information does not contain spaces. > diff --git a/libgetopt++/include/getopt++/DefaultFormatter.h b/libgetopt++/include/getopt++/DefaultFormatter.h > index ee2397f5..19ac67e1 100644 > --- a/libgetopt++/include/getopt++/DefaultFormatter.h > +++ b/libgetopt++/include/getopt++/DefaultFormatter.h > @@ -64,6 +64,7 @@ class DefaultFormatter { > { > // TODO: consider using a line breaking strategy here. > int pos = helpmsg.substr(0,h_len).find_last_of(" "); > + if (pos <= 0) break; > theStream << helpmsg.substr(0,pos) > << std::endl << std::string (o_len, ' '); > helpmsg.erase (0,pos+1); It seems that the best approach for Chinese translations would be to: - add spaces at sentence or word breaks in translations before 35 or 45 bytes, if that is the length unit, worth of characters are output in each column; or - add a language dependent line breaking strategy, to honour characters not to be placed at the beginning or ends of lines or split; or - split between characters, as with long strings in other languages. -- Take care. Thanks, Brian Inglis Calgary, Alberta, Canada La perfection est atteinte Perfection is achieved non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut -- Antoine de Saint-Exupéry