Introduction
When working with Uniface ProcScript, you might encounter mysterious syntax errors that seem to point at perfectly valid code. The culprit could be invisible non-breaking space characters (0xA0) lurking in your source files. This article explains the $ALLOW_NOBREAK_SPACE configuration parameter and how it can help you deal with this common issue.
What is $ALLOW_NOBREAK_SPACE?
$ALLOW_NOBREAK_SPACE is a configuration parameter in Uniface 10.4 that controls whether non-breaking spaces (hexadecimal value 0xA0) are allowed in ProcScript code. By default, these characters cause syntax errors when the Uniface compiler encounters them.
Syntax:
$ALLOW_NOBREAK_SPACE = 1 | 0
Values:
- 1 - Non-breaking spaces (0xA0) are allowed in ProcScript
- 0 - Non-breaking spaces cause syntax errors
- Default: None (not set, behaves like 0)
Configuration
The parameter is configured in the client assignment file under the [SETTINGS] section:
[SETTINGS]
$ALLOW_NOBREAK_SPACE = 1
Understanding Non-Breaking Spaces
Non-breaking spaces (Unicode U+00A0, hex 0xA0) differ from regular spaces (0x20). They're designed to prevent line breaks between words, commonly used in word processors and web content. However, in source code, they're usually unintentional and problematic.
How Do They Get Into Your Code?
Non-breaking spaces typically sneak into ProcScript through:
- Copy-pasting from documents - Word documents, PDFs, or web pages often contain 0xA0 characters
- Text editors - Some editors insert non-breaking spaces automatically
- Legacy code migration - Older systems or documentation may include these characters
- International keyboards - Certain keyboard layouts can insert them accidentally
Common Problems Without This Parameter
When $ALLOW_NOBREAK_SPACE is not enabled, you may experience:
1. Invisible Syntax Errors
Error: Syntax error at line 42
Your code looks perfect, but the compiler disagrees. The 0xA0 character is visually identical to a regular space, making debugging extremely difficult.
2. Environment-Specific Issues
Code that compiles fine on one developer's machine fails on another, depending on their configuration settings.
3. Migration Headaches
When importing legacy code or documentation examples, you might face compilation failures that are hard to trace.
Best Practices
When to Enable It
Set $ALLOW_NOBREAK_SPACE = 1 when:
- Working with legacy codebases that may contain these characters
- Your team frequently copies code from external sources
- Experiencing unexplained syntax errors in seemingly correct code
Long-Term Solution
While enabling this parameter is a practical workaround, the ideal approach is to clean your codebase:
- Use a hex editor or specialized tool to find and replace 0xA0 with 0x20
- Configure your IDE to highlight non-breaking spaces
- Establish coding standards to prevent these characters from entering your codebase
- Use version control pre-commit hooks to detect and warn about 0xA0 characters
Detection and Cleanup
Here's a simple approach to find non-breaking spaces in your code:
- Visual Studio Code: Use the find and replace feature with regex enabled and search for \xA0
- Command-line tools: Use grep or similar tools to scan files
- Uniface IDE: Check compiler error messages carefully for unexpected character warnings
Conclusion
The $ALLOW_NOBREAK_SPACE parameter is a useful configuration option for managing non-breaking spaces in Uniface ProcScript. While it provides a quick fix for syntax errors caused by 0xA0 characters, the best practice is to maintain clean source code that only contains standard spaces (0x20).
Understanding this parameter can save hours of debugging time and prevent frustration when working with ProcScript code from various sources.
References:
- Uniface 10.4 Official Documentation - Configuration Reference
Have you encountered non-breaking space issues in your Uniface projects? Share your experiences in the comments!
Top comments (0)