bigfunctions > convert_non_ascii_characters_to_unicode_escape_sequences
convert_non_ascii_characters_to_unicode_escape_sequences¶
Call or Deploy convert_non_ascii_characters_to_unicode_escape_sequences
?
✅ You can call this convert_non_ascii_characters_to_unicode_escape_sequences
bigfunction directly from your Google Cloud Project (no install required).
- This
convert_non_ascii_characters_to_unicode_escape_sequences
function is deployed inbigfunctions
GCP project in 39 datasets for all of the 39 BigQuery regions. You need to use the dataset in the same region as your datasets (otherwise you may have a function not found error). - Function is public, so it can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
- You may prefer to deploy the BigFunction in your own project if you want to build and manage your own catalog of functions. This is particularly useful if you want to create private functions (for example calling your internal APIs). Discover the framework
Public BigFunctions Datasets:
Region | Dataset |
---|---|
eu |
bigfunctions.eu |
us |
bigfunctions.us |
europe-west1 |
bigfunctions.europe_west1 |
asia-east1 |
bigfunctions.asia_east1 |
... | ... |
Description¶
Signature
convert_non_ascii_characters_to_unicode_escape_sequences(text)
Description
Replace all non ASCII characters with escape unicode
Examples¶
select bigfunctions.eu.convert_non_ascii_characters_to_unicode_escape_sequences('SCHÜMANN')
select bigfunctions.us.convert_non_ascii_characters_to_unicode_escape_sequences('SCHÜMANN')
select bigfunctions.europe_west1.convert_non_ascii_characters_to_unicode_escape_sequences('SCHÜMANN')
+----------------------+
| text_unicode_escaped |
+----------------------+
| SCH\u00dcMANN |
+----------------------+
Need help using convert_non_ascii_characters_to_unicode_escape_sequences
?
The community can help! Engage the conversation on Slack
For professional suppport, don't hesitate to chat with us.
Found a bug using convert_non_ascii_characters_to_unicode_escape_sequences
?
If the function does not work as expected, please
- report a bug so that it can be improved.
- or open the discussion with the community on Slack.
For professional suppport, don't hesitate to chat with us.
Use cases¶
This function is useful for handling text data that needs to be compatible with systems or formats that don't fully support Unicode characters. Here are some use cases:
-
Data exchange: When exchanging data between different systems, especially older systems that might not support Unicode, converting non-ASCII characters to their escape sequences ensures that the text is correctly interpreted on the receiving end. For example, exchanging data with a system that only supports ASCII or a specific character encoding.
-
JSON serialization: Some JSON parsers or systems have issues with non-ASCII characters. Converting them to Unicode escape sequences ensures proper serialization and deserialization of the data.
-
CSV export: Similar to data exchange, when exporting data to CSV, especially if the encoding is not explicitly defined or if the receiving system has limited Unicode support, escaping the characters can prevent data corruption or misinterpretation.
-
Legacy system integration: When integrating with legacy systems that only support ASCII, this function allows you to store or process Unicode data while maintaining compatibility.
-
Web applications: In certain web applications, especially those dealing with user-generated content, escaping non-ASCII characters can prevent issues related to character encoding and cross-site scripting (XSS) vulnerabilities.
-
Regular expressions: Some regular expression engines might not correctly handle Unicode characters. Escaping them can simplify the regex patterns and avoid unexpected behavior.
-
Debugging: When debugging text processing issues, converting non-ASCII characters to escape sequences can make it easier to identify and analyze the characters causing problems.
In essence, the function acts as a bridge between systems or formats with differing levels of Unicode support, ensuring data integrity and preventing potential errors.
Spread the word¶
BigFunctions is fully open-source. Help make it a success by spreading the word!