convert_non_ascii_characters_to_unicode_escape_sequences¶
convert_non_ascii_characters_to_unicode_escape_sequences(text)
Description¶
Replace all non ASCII characters with escape unicode
Usage¶
Call or Deploy convert_non_ascii_characters_to_unicode_escape_sequences
?
Call convert_non_ascii_characters_to_unicode_escape_sequences
directly
The easiest way to use bigfunctions
convert_non_ascii_characters_to_unicode_escape_sequences
function is deployed in 39 public datasets for all of the 39 BigQuery regions.- It can be called by anyone. Just copy / paste examples below in your BigQuery console. It just works!
- (You need to use the dataset in the same region as your datasets otherwise you may have a function not found error)
Public BigFunctions Datasets
Region | Dataset |
---|---|
eu |
bigfunctions.eu |
us |
bigfunctions.us |
europe-west1 |
bigfunctions.europe_west1 |
asia-east1 |
bigfunctions.asia_east1 |
... | ... |
Deploy convert_non_ascii_characters_to_unicode_escape_sequences
in your project
Why deploy?
- You may prefer to deploy
convert_non_ascii_characters_to_unicode_escape_sequences
in your own project 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).
- Get started by reading the framework page
Deployment
convert_non_ascii_characters_to_unicode_escape_sequences
function can be deployed with:
pip install bigfunctions
bigfun get convert_non_ascii_characters_to_unicode_escape_sequences
bigfun deploy convert_non_ascii_characters_to_unicode_escape_sequences
Examples¶
select bigfunctions.eu.convert_non_ascii_characters_to_unicode_escape_sequences("SCH\u00dcMANN")
select bigfunctions.us.convert_non_ascii_characters_to_unicode_escape_sequences("SCH\u00dcMANN")
select bigfunctions.europe_west1.convert_non_ascii_characters_to_unicode_escape_sequences("SCH\u00dcMANN")
+----------------------+
| text_unicode_escaped |
+----------------------+
| SCH\u00dcMANN |
+----------------------+
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.
Need help or Found a bug?
Get help using convert_non_ascii_characters_to_unicode_escape_sequences
The community can help! Engage the conversation on Slack
We also provide professional suppport.
Report a bug about 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.
We also provide professional suppport.