summaryrefslogtreecommitdiff
path: root/src/core/recode.c
AgeCommit message (Collapse)Author
2017-10-20Make split functions return an array with NULL instead of NULLJoseph Bisch
This avoids undefined behavior in functions that call these split functions and expect an array back instead of just a NULL pointer.
2014-10-19Try to split long lines on spacesSebastian Thorarensen
Try to split long lines on spaces to avoid words being splitted. This can be turned off with the option `split_line_on_space'. The code assumes that the terminal encoding has ASCII spaces.
2014-07-06Fix minor coding style issues in message splittingSebastian Thorarensen
2014-07-06Properly split long IRC messagesSebastian Thorarensen
This commit adds handling of long IRC messages to the core. In contrast to the `splitlong.pl' plugin, multi-byte encoded and recoded messages are properly split. To allow for this, a new function has been added to the server struct: `split_message'. `split_message' returns a string array with the message splitted to substrings of a length that the server can handle. If a protocol module doesn't have any limit, it can simply return a singleton array with a copy of the message. The `MSG' chat command now calls `split_message' before `send_message', and emits `message own_public' / `message own_private' with each substring, so that the string splitting will be visible in the UI. `split_message' in the IRC module uses `recode_split' which in turn uses iconv to properly split multi-byte encoded (and recoded) messages.
2008-11-29Amend fix for bug #392, assume utf-8 encoding for an ascii string inEmanuele Giaquinta
which no escape character occurs. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4928 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-11-28Factor code to check if a string is ascii only into a function.Emanuele Giaquinta
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4926 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-06-10Cache charset related data rather than computing it everytime recode_{in,out}Emanuele Giaquinta
is called. git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4862 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-04-05Partly revert r4796, it is not a bug but by design thatEmanuele Giaquinta
recode_fallback is honored only when the terminal encoding is utf-8. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4799 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-04-05Cosmetics.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4797 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-04-05Fix logic in recode_in:Emanuele Giaquinta
Honour recode_fallback also when the terminal encoding is not utf-8. Return the string as it is when the terminal encoding is utf-8, the string is valid utf-8, and the first conversion failed, rather than trying again the same conversion. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4796 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-03-09Use g_ascii_str{,n}casecmp for case insensitive comparison withEmanuele Giaquinta
ascii only strings. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4738 dbcabf3a-b0e7-0310-adc4-f8d773084564
2008-02-04Remove trailing whitespace.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4705 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-12-09Simplify is_valid_charset by just checking with g_iconv_open that theEmanuele Giaquinta
conversion is supported. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4665 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-20Farewell glib-1.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4509 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-18Factor common code in recode_{in,out}.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4499 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-08Oops. Update address correctly now.Wouter Coekaerts
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4490 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-08Update FSF addressWouter Coekaerts
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4489 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-05-06Do not call iconfig_get_str when target is NULL.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4487 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-01-06Reindent.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4405 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-01-06Remove the target != NULL constraint in recode_out.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4404 dbcabf3a-b0e7-0310-adc4-f8d773084564
2007-01-06Simplify.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4403 dbcabf3a-b0e7-0310-adc4-f8d773084564
2006-09-20Cosmetic.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4372 dbcabf3a-b0e7-0310-adc4-f8d773084564
2006-09-20Make compilation of is_translit conditional on glib-2.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4369 dbcabf3a-b0e7-0310-adc4-f8d773084564
2006-09-20Add public is_utf8 function by refactoring existing code.Emanuele Giaquinta
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4368 dbcabf3a-b0e7-0310-adc4-f8d773084564
2006-07-25Don't assume that 7bit ascii strings are encoded in UTF-8, only validate the ↵Valentin Batz
strings when they contain octest with highest bit set. (patch by Mikko Rauhala) fixes http://bugs.irssi.org/index.php?do=details&id=392 git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4300 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-11-19If transliterations don't work in the system (eg. Solaris), don't allowTimo Sirainen
recode_transliterate setting to be enabled. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4082 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-11-19Default recode_transliterate to yesTimo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4079 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-11-07changed recode_fallback to CP1252Valentin Batz
added recode_autodetect_utf8, it's on by default removed settings_remove calls from recode_deinit since I don't see any other internal module doing it git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4067 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-10-16fixed a bug in recode when target is NULL and really use the recoded string ↵Valentin Batz
for printing git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4042 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-10-10Don't crash with /me in dcc, or dcc message on disconnected server, with ↵Wouter Coekaerts
recode (Bug 330) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4033 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-07-24Forgot to add the additional parameter to g_convert_with_fallback (This ↵Valentin Batz
always happens when I'm applying patches manually :( ) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3882 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-07-24Added an option to specify a charset for a whole network. For example ↵Valentin Batz
/recode add IRCnet iso-8859-1 (http://bugs.irssi.org/index.php?do=details&id=284) Patch by Sergey Safonov. Replaced g_convert by g_convert_with_fallback in recode_in (http://bugs.irssi.org/index.php?do=details&id=241) Patch by Kuang-che Wu. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3881 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-06-29Added a new boolean setting 'recode' to provide an opportunity to turn off ↵Valentin Batz
recode completely git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3805 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-01-12call setlocale(LC_ALL, ) once in fe-text/irssi.c and not everytime ↵Valentin Batz
recode_get_charset() is called in recode.c git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3703 dbcabf3a-b0e7-0310-adc4-f8d773084564
2005-01-12call setlocale(LC_ALL, ) before g_get_charset to properly return the user's ↵Valentin Batz
charset git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3702 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-12-20Fixed target handling in recode_outValentin Batz
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3693 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-12-20Added <tag>/<target> support for recode.Valentin Batz
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3692 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-09-20Changed the order of recode_out_default_charset, it doesn't override /recode ↵Valentin Batz
add anymore. The string returned by nl_langinfo(CODESET) may be empty, use ISO8859-1 in this case git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3306 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-09-18Forgot g_free(translit_to); in recode_inValentin Batz
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3304 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-09-15Fixed memleak in recode.c, fixed typo in special_vars.txt, fixed bug 105, ↵Valentin Batz
fixed bug 106 git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3295 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-08-21Bug #104 recode treats multibyte jp characters as utf8. Patch by ValentinTimo Sirainen
Batz git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3285 dbcabf3a-b0e7-0310-adc4-f8d773084564
2004-08-20forgot to addTimo Sirainen
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3284 dbcabf3a-b0e7-0310-adc4-f8d773084564