X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D3FF4385842C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1711684931; bh=GpB/oRSoyKdwqvY9PDqyq1thKnWjVcfkDlJ8nOcgD9c=; h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=Wvv/04iAMtCkwZUhH1hCyjTWtEM58ou8UzF251BSwIXIZiXeKjWhLr6EKJFCjDpKH rDUFl+toj27BEeupzAqK8npNtBJnST2DxgFszMZyUsDGGvggwSirL5LKrmaQV2IgiK HDE+FWk62vB8KUC1nN5RyPlyIzF17I+3XDySPAgs= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 651ED3858D20 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 651ED3858D20 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 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 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 AT cygwin DOT com References: Organization: Systematic Software In-Reply-To: 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 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Brian Inglis via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Brian Inglis Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 42T42DKE4097884 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 -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple