{"id":20826954,"url":"https://github.com/mklement0/print-nonascii","last_synced_at":"2026-03-19T17:42:27.749Z","repository":{"id":57330504,"uuid":"103061582","full_name":"mklement0/print-nonascii","owner":"mklement0","description":"Unix CLI that prints lines that contain non-ASCII characters.","archived":false,"fork":false,"pushed_at":"2022-12-27T14:09:20.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-18T17:52:27.132Z","etag":null,"topics":["ascii","cli","diagnostic-tool","unicode","unix-cli"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mklement0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-10T21:00:40.000Z","updated_at":"2024-09-22T04:38:44.000Z","dependencies_parsed_at":"2023-01-31T03:25:22.485Z","dependency_job_id":null,"html_url":"https://github.com/mklement0/print-nonascii","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Fprint-nonascii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Fprint-nonascii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Fprint-nonascii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mklement0%2Fprint-nonascii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mklement0","download_url":"https://codeload.github.com/mklement0/print-nonascii/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243174639,"owners_count":20248316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii","cli","diagnostic-tool","unicode","unix-cli"],"created_at":"2024-11-17T23:10:38.103Z","updated_at":"2026-01-31T23:11:54.871Z","avatar_url":"https://github.com/mklement0.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm version](https://img.shields.io/npm/v/print-nonascii.svg)](https://npmjs.com/package/print-nonascii)[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mklement0/print-nonascii/blob/master/LICENSE.md)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n**Contents**\n\n- [print-nonascii: print lines that contain non-ASCII characters.](#print-nonascii-print-lines-that-contain-non-ascii-characters)\n- [Examples](#examples)\n- [Installation](#installation)\n  - [Prerequisites](#prerequisites)\n  - [Installation from the npm registry](#installation-from-the-npm-registry)\n  - [Manual installation](#manual-installation)\n- [Usage](#usage)\n- [License](#license)\n  - [Acknowledgements](#acknowledgements)\n  - [npm dependencies](#npm-dependencies)\n- [Changelog](#changelog)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n# print-nonascii: print lines that contain non-ASCII characters.\n\n`print-nonascii` is a Unix CLI that locates lines in text files or   \nstdin input that contain non-ASCII characters, which is helpful when  \ndiagnosing character encoding problems.\n\nLines can be printed as-is and/or using abstract representations of non-ASCII\ncharacters in one of several formats; namely:\n\n* `-v`, `--caret` ... the same representation `cat -v` uses, based on caret notation.\n* `--bash` ... per-_byte_ two-digit hex. escape sequences such as `\\xc3`\n* `--psh` ... PowerShell Unicode escape sequences such as `` `u{20ac} `` for `€`\n\nNote: `--psh` only works correctly with properly UTF-8-encoded input.\n\nLine numbers can be prepended on request, and output for multiple input\nfiles is by default preceded with headers identifying each input file.\n\n_Caveat: For now, no automated tests are run before releases._\n\n# Examples\n\n```sh\n# Create a test file with 1 line containing a non-ASCII character.\n$ cat \u003c\u003c'EOF' \u003e /tmp/test.txt\none\ntwö\nthree\nEOF\n\n# Print only lines that have non-ASCII characters, as-is.\n$ print-nonascii /tmp/test.txt\ntwö\n\n# Print only lines that have non-ASCII characters, with line numbers:\n$ print-nonascii -n /tmp/test.txt\n2:twö\n\n# Print only lines that have non-ASCII characters, using PowerShell \n# Unicode escape-sequence notation (--psh), preceded by the \n# line as-is (--raw).\n# The Unicode code point of character \"ö\" is U+00F6:\n$ print-nonascii --psh --raw /tmp/test.txt\ntwö\ntw`u{f6}\n\n# Ditto with line numbers and per-byte Bash escape sequences:\n$ print-nonascii --bash --raw /tmp/test.txt\ntwö\ntw\\xc3\\xb6\n\n# Simulate input from multiple files by specifying the same file\n# twice, so as to show the headers identifying each input file \n# (suppress with -b).\n# Note that each header line (invisibly) starts with control \n# character U+0001, so as to allow more predictable\n# identification of header lines in the output.\n$ print-nonascii -n /tmp/test.txt /tmp/test.txt \n\u0001###\t/tmp/test.txt\n2:twö\n\u0001###\t/tmp/test.txt\n2:twö\n```\n\n# Installation\n\n## Prerequisites\n\n* When installing from the **npm registry**: **macOS** and **Linux**\n* When installing **manually**: any Unix platform with `bash` that also has `perl` installed.\n\n## Installation from the npm registry\n\nWith [Node.js](http://nodejs.org/) installed, install [the package](https://www.npmjs.com/package/print-nonascii) as follows:\n\n    [sudo] npm install print-nonascii -g\n\n**Note**:\n\n\u003csup\u003eNote: Even if you don't use Node.js, its package manager, `npm`, works across platforms and is easy to install; try [`curl -L https://git.io/n-install | bash`](https://github.com/mklement0/n-install)\u003c/sup\u003e\n\n* Whether you need `sudo` depends on how you installed Node.js / io.js and whether you've [changed permissions later](https://docs.npmjs.com/getting-started/fixing-npm-permissions); if you get an `EACCES` error, try again with `sudo`.\n* The `-g` ensures [_global_ installation](https://docs.npmjs.com/getting-started/installing-npm-packages-globally) and is needed to put `print-nonascii` in your system's `$PATH`.\n\n## Manual installation\n\n* Download [the CLI](https://raw.githubusercontent.com/mklement0/print-nonascii/stable/bin/print-nonascii) as `print-nonascii`.\n* Make it executable with `chmod +x print-nonascii`.\n* Move it or symlink it to a folder in your `$PATH`, such as `/usr/local/bin` (macOS) or `/usr/bin` (Linux).\n\n# Usage\n\nFind concise usage information below; for complete documentation, read the [manual online](doc/print-nonascii.md), or, once installed, run `man print-nonascii` (`print-nonascii --man` if installed manually).\n\n\u003c!-- DO NOT EDIT THE FENCED CODE BLOCK and RETAIN THIS COMMENT: The fenced code block below is updated by `make update-readme/release` with CLI usage information. --\u003e\n\n```nohighlight\n$ print-nonascii --help\n\n\nPrints lines that contain non-ASCII characters.\n\n    print-nonascii [--\u003cmode\u003e [-r]] [-n] [-b] [file ...]\n    print-nonascii -q                        [file ...]\n\n    --\u003cmode\u003e prints abstract representations of non-ASCII chars.; one of:\n      --caret, -v ... use caret notation, as cat -v would.\n      --bash ... represent non-ASCII bytes as \\xhh \n      --psh ... (PowerShell) represent non-ASCII Unicode characters as  \n                Unicode escape sequences: \u003cbacktick\u003eu{h...}\n    \n    -r, --raw ... with --\u003cmode\u003e, print each matching line as-is too, first.\n\n    -n, --line-number ... prefix the output lines with their line number from  \n     the original file, using format \"\u003cline-number\u003e:\" - decimal line numbers,  \n     no padding, no space before or after the \":\"\n\n    -b, --bare ... suppress per-input-filename headers\n\n    -q ... quiet mode: produce no output; signal presence of non-ASCII chars.  \n           with exit code 0; exit code 100 signals that there are none.\n\nStandard options: --help, --man, --version, --home\n```\n\n\u003c!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'LICENSE.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. --\u003e\n\n# License\n\nCopyright (c) 2017 Michael Klement \u003cmklement0@gmail.com\u003e (http://same2u.net), released under the [MIT license](https://spdx.org/licenses/MIT#licenseText).\n\n## Acknowledgements\n\nThis project gratefully depends on the following open-source components, according to the terms of their respective licenses.\n\n[npm](https://www.npmjs.com/) dependencies below have an optional suffix denoting the type of dependency: the *absence* of a suffix denotes a required *run-time* dependency; `(D)` denotes a *development-time-only* dependency, `(O)` an *optional* dependency, and `(P)` a *peer* dependency.\n\n\u003c!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the dependencies from 'package.json'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. --\u003e\n\n## npm dependencies\n\n* [doctoc (D)](https://github.com/thlorenz/doctoc#readme)\n* [json (D)](https://github.com/trentm/json#readme)\n* [marked-man (D)](https://github.com/kapouer/marked-man#readme)\n* [replace (D)](https://github.com/harthur/replace#readme)\n* [semver (D)](https://github.com/npm/node-semver#readme)\n* [urchin (D)](https://git.sdf.org/tlevine/urchin)\n\n\u003c!-- DO NOT EDIT THE NEXT CHAPTER and RETAIN THIS COMMENT: The next chapter is updated by `make update-readme/release` with the contents of 'CHANGELOG.md'. ALSO, LEAVE AT LEAST 1 BLANK LINE AFTER THIS COMMENT. --\u003e\n\n# Changelog\n\nVersioning complies with [semantic versioning (semver)](http://semver.org/).\n\n\u003c!-- RETAIN THIS COMMENT. An entry template for a new version is automatically added each time `make version` is called. Fill in changes afterward. --\u003e\n\n* **[v0.0.3](https://github.com/mklement0/print-nonascii/compare/v0.0.2...v0.0.3)** (2017-09-11):\n  * [enhancement] Header lines are now only printed for input files that produce at least 1 output line.\n\n* **[v0.0.2](https://github.com/mklement0/print-nonascii/compare/v0.0.1...v0.0.2)** (2017-09-10):\n  * [fix] Header line is no longer printed twice when `--\u003cmode\u003e` is combined with `--raw`.\n  * Header line now uses a tab char. to separate prefix `###` from the filename.\n\n* **v0.0.1** (2017-09-10):\n  * Initial release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmklement0%2Fprint-nonascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmklement0%2Fprint-nonascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmklement0%2Fprint-nonascii/lists"}