Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

Don't tell any big lies today. Small ones can be just as effective.


comp / comp.unix.shell / Re: using Unicode codepoints in a bash script

SubjectAuthor
o Re: using Unicode codepoints in a bash scriptQruqs

1
Subject: Re: using Unicode codepoints in a bash script
From: Qruqs
Newsgroups: comp.unix.shell
Organization: Easynews - www.easynews.com
Date: Sun, 18 Aug 2024 08:04 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!feeder3.eternal-september.org!weretis.net!feeder8.news.weretis.net!news.neodome.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx16.ams4.POSTED!not-for-mail
From: qruqs@no.email.invalid (Qruqs)
Subject: Re: using Unicode codepoints in a bash script
Newsgroups: comp.unix.shell
References: <aa6382e4-af81-47fd-9ed0-ae72d8277374n@googlegroups.com>
MIME-Version: 1.0
X-No-Archive: Yes
User-Agent: Pan/0.159 (Vovchansk; 25e128a)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Lines: 57
Message-ID: <gWhwO.419042$4Vg4.389332@fx16.ams4>
X-Complaints-To: abuse@easynews.com
Organization: Easynews - www.easynews.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Sun, 18 Aug 2024 08:04:28 GMT
X-Received-Bytes: 2752
View all headers

On Wed, 29 Nov 2023 00:01:06 -0800 (PST), paris2venice wrote:

> bash --version GNU bash, version 3.2.57(1)-release
> (x86_64-apple-darwin20)
> Copyright (C) 2007 Free Software Foundation, Inc.

Like many already said Bash version might be an issue, I use:

$ bash --version
GNU bash, version 5.2.26(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2022 Free Software Foundation, Inc.

Plus, I don't know if there is anyone still around to even bother about my
posting this (seems it went dead after that stupid googlegroups was turned
off, finally! "do no harm", right...), and I also know this isn't a Python
group, but anyhoo, since it's more or less dead anyway...

Is there a reason it _has_ to be Bash?

You could try another language. Python for instance, can also be run like
an executable text file, just like a shell script. You can also call other
scripts from Python, for example running the stuff that is easier to do in
Python and when it's done call some other script and have it have a go at
solving the rest. You can also use the "sys" module and use pipes into
your Python script and it can send its result out via stdout. Your
imagination is the limit here.

Python 3.12: test-hieroglyphs-post-20240818.py

CODE:
---8<-------------------------------------------------------------------
#! /usr/bin/env python3
#coding: utf-8
print("As is:", "ð“€€")
print("Using character names:", chr(ord('\N{EGYPTIAN HIEROGLYPH A001}')))
print("The code points as hex:", "ð“€€".encode('utf-8'))
---8<-------------------------------------------------------------------

Running it:
$ ./test-hieroglyphs-post-20240818.py
As is: ð“€€
Using character names: ð“€€
The code points as hex bytes: b'\xf0\x93\x80\x80'

This works because Python 3.x is Unicode aware. All strings are Unicode by
default.

There are other languages that might be suitable also. Pick one and try it
out.

There are more ways than one to skin a cat.

Q.
--
Currently using: https://manjaro.org/

1

rocksolid light 0.9.8
clearnet tor