Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Wide-Latin bash script?

Name: Anonymous 2010-06-05 0:56

Is there any script, preferably bash or Perl, that will convert normal ASCII ("deal") into wide-width latin ("deal")?

Thanks.

Name: Anonymous 2010-06-05 0:58

Yes, there is.

Name: Anonymous 2010-06-05 1:18

Please link?

Name: Anonymous 2010-06-05 1:23

function ascii_to_wwlatin ($str)
{
    $retval = '';
    foreach (str_split($str) as $chr) {
        $ord = ord($chr);
        $retval .= $ord > 32 && $ord < 127 ?
                           html_entity_decode('&#' . ($ord + 65248) . ';', ENT_NOQUOTES, 'UTF-8') :
                           chr($ord);
    }
    return $retval;
}


echo ascii_to_wwlatin('Hi, >>1. I\'m using PHP. DEAL with it!');

Hi, >>1. I'm using PHP. DEAL with it!

Name: Anonymous 2010-06-05 1:44

>>4
That is pretty cool. Thanks. Would be better if I could pass the args to it -> so I can /exec it in irssi.

Name: Anonymous 2010-06-05 1:58

>>5
something like this?


if ($_SERVER['argc'] == 1) {
    echo "usage: php asc2wwl.php [ascii string]\n";
    exit();
}

echo ascii_to_wwlatin($_SERVER['argv'][1]);

Name: Anonymous 2010-06-05 2:07

>>6
Sweet.

I get:
>06:07:01 No entry for terminal type "tty";
>06:07:01 using dumb terminal settings.
in irssi when I exec it. What might be the cause?

Name: Anonymous 2010-06-05 4:26

>>7
What might be the cause?
Not making proper Shiitchan quotes would probably be it.

Name: Anonymous 2010-06-05 4:27

>>8
Please don't give me that, I most often frequent the image-boards.

Do you know why I would get that PHP error?

Name: Anonymous 2010-06-05 4:30

#!/usr/bin/perl -pl
use encoding utf8;
y/!-~/\x{ff01}-\x{ff5e}/;


and for >>5:
#!/usr/bin/perl -l40
use encoding utf8;
y/!-~/\x{ff01}-\x{ff5e}/ and print for @ARGV;

Name: Anonymous 2010-06-05 4:32

>>9
you're using php.

Name: Anonymous 2010-06-05 4:42

>>10
Thanks /expert programmer/.

Name: Anonymous 2010-06-05 5:38

i wrote a c program to do it

Name: Anonymous 2010-06-05 7:52

>>9
I most often frequent the image-boards.
>>10
Why are you helping him?

Name: Anonymous 2010-06-05 8:07

>>14
perl one-liners are a lot less helpful than the other posts in this thread.

Name: Anonymous 2010-06-05 8:09

>>15
Yeah, in that they do the job in more than one line. Unhelpful bastards.

Name: Anonymous 2010-06-05 8:14

>>16
i meant ones like >>8,11.

Name: Anonymous 2010-06-05 11:23

>>17
Using PHP is a legitimate problem.

Name: Anonymous 2010-06-05 11:30

Why do you need any of this?  Learn to use a shell.
$ echo hax my anus | tr \ -~  !-~
hax my anus

Name: Anonymous 2010-06-05 13:44

>>19
explain!

Name: Anonymous 2010-06-05 13:52

>>20
DEAL WITH IT

Name: Anonymous 2010-06-05 14:00

>>19
More like
$ echo hax my anus | tr \ -~  !-~
Ľ��������

Name: Anonymous 2010-06-05 14:15

AAAAAAAAAAAAAAAAAAAAAAAAA

Name: Anonymous 2010-06-05 14:16

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Name: Anonymous 2010-06-05 14:32

>>19
that only works if your tr supports unicode, which is not the case on many systems. perl always supports unicode.

Name: Anonymous 2010-06-05 14:41

bump

Name: Anonymous 2010-06-05 15:04

>>25
$ echo hax my anus | perl -pe 'tr/[ -~]/[!-~]/;'
����������


Goddamn liar.
Meanwhile, Xarn's program works fine:

$ echo hax my anus | fullwidth
hax my anus

Name: Anonymous 2010-06-05 15:27

For the record:

/* Copyright (c) 2009 Xarn
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#define __STDC_ISO_10646__  200104L
#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <locale.h>

int main(void)
{
    char *buffa = NULL;
    unsigned int n;

    if (setlocale(LC_CTYPE, "") == NULL) {
        fprintf(stderr, "Locale not specified. Fix this.\n");
        return 1;
    }

    while (getline(&buffa, &n, stdin) != -1) {
        char *c;

        for (c = buffa; *c; ++c)
            printf("%lc", '!' <= *c && *c <= '~' ? *c + 0xfee0
                                                 : *c == ' ' ? 0x3000
                                                             : *c);

        free(buffa);
        buffa = NULL;
    }

    return 0;
}

Name: Anonymous 2010-06-05 15:27

What is wrong with just typing with wide characters? You don’t need a script for it.

Name: FrozenVoid⤆ 2010-06-05 16:20

>>29
How?

Name: Anonymous 2010-06-05 16:34

>>30
If you don't even know how keyboard layouts are set, maybe you should ask in /g/.

Name: Anonymous 2010-06-05 16:36

>>30
Full−width Romaji mode

Name: Anonymous 2010-06-05 16:39

>>30
Why would you do something that doesn’t preserve screen real estate?

Name: Anonymous 2010-06-05 17:27

>>33
doesn’t
You fail it, don't you?

Name: Anonymous 2010-06-05 17:29

>>32
Oh snap motherfucker!  This is awesome! :)

Name: Anonymous 2010-06-05 17:36

>>35
You failed it again, >>33-san. Or perhaps I Have Beet Rolled

Name: Anonymous 2010-06-05 17:49

This thread is an abomination. Have we really sunk so low as to be amused by simple functionality?

Name: sorry 2010-06-05 18:10

ifeelkindofbadaboutthat:(

Name: Anonymous 2010-06-05 18:38

>>37
Just like every tripcode thread has to drown in idiots testing their tripcodes, every thread that allows people to produce output they can post will be flooded with that. Even if most of them never figure out how to do it properly.

Name: Anonymous 2010-06-05 18:42

hey guys am I doing it right?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List