【问题标题】:Perl Net::Jabber::Bot new linePerl Net::Jabber::Bot 新行
【发布时间】:2012-12-06 18:49:02
【问题描述】:

我在我的 Perl 脚本中使用Net::Jabber::Bot 模块,它工作正常,但一个问题是,当我想发送消息时,所有新行都会被删除!两个问题:

  1. 我们如何在消息中添加新行?我们应该在某处禁用chomp 吗?
  2. Jabber/XMPP 中的新行会发生什么情况?

【问题讨论】:

    标签: perl xmpp newline


    【解决方案1】:

    这是一个已知问题,有人已经为此提交了补丁:http://code.google.com/p/perl-net-jabber-bot/issues/detail?id=24

    您无法直接发送 \n,但如果该代码不包含不可打印的字符,您也许可以发送 xmpp/jabber 编码的换行符。

    在这个子里:

    sub _send_individual_message {
    ...
    # Strip out anything that's not a printable character
    # Now with unicode support?
    $message_chunk =~ s/[^[:print:]]+/./xmsg; 
    

    【讨论】:

    • 普通邮件换行没有问题。引用的文本是指数据表单。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-18
    • 1970-01-01
    相关资源
    最近更新 更多