Skip to main content
Use the isascii function to check whether a string contains only ASCII characters. It returns true if every character in the input string belongs to the ASCII character set (for example, character codes 0–127) and false otherwise. The function is useful in scenarios where you want to detect non-ASCII text in logs, validate inputs for encoding compliance, or identify potential anomalies introduced by copy-pasted foreign characters or malformed input in user-submitted data.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
Splunk SPL doesn’t have a direct equivalent to isascii. To achieve similar functionality, you typically need to use match() or custom regular expressions. In contrast, APL provides isascii as a simple built-in function, making the check much more concise and performant.
... | eval is_ascii=if(match(field, "^[\x00-\x7F]+$"), "true", "false")
ANSI SQL doesn’t provide a built-in isascii function. You often need to simulate it using regular expressions or character code checks. APL simplifies this with the dedicated isascii function.
SELECT input,
       CASE WHEN input ~ '^[\x00-\x7F]+$' THEN true ELSE false END AS is_ascii
FROM my_table;

Usage

Syntax

isascii(value)

Parameters

NameTypeDescription
valuestringThe input string to check for ASCII content

Returns

A bool value:
  • true if all characters in value are ASCII characters.
  • false if any character is outside the ASCII range.

Use case examples

  • Log analysis
  • OpenTelemetry traces
  • Security logs
Identify non-ASCII characters in request URIs to detect unusual or malformed traffic.Query
['sample-http-logs']
| extend is_ascii_uri = isascii(uri)
| summarize count() by is_ascii_uri
Run in PlaygroundOutput
is_ascii_uricount_
true14250
false130
This query flags requests with non-ASCII characters in the uri field. These entries can indicate abnormal requests or encoding issues in log data.
I