I ran into an old space restore error recently on a Confluence 7.15.1 (datacenter):
Import failed. Check your server logs for more information. com.atlassian.confluence.importexport.ImportExportException: Unable to complete import: An invalid XML character (Unicode: 0xb) was found in the CDATA section.
This is just a post of solution notes using PowerShell to resolve the issue.
Known Confluence bug: Unable to complete import: An invalid XML character (Unicode: 0xffff) was found in the CDATA section
Identifying Invalid Characters: https://confluence.atlassian.com/confkb/how-to-identify-invalid-characters-on-a-confluence-page-911180364.html
Removing Invalid Characters: https://confluence.atlassian.com/jira/removing-invalid-characters-from-xml-backups-12079.html
Unicode Lookup: https://unicodelookup.com/#0xb/1
Using a Window's OS computer, leverage the use of a PowerShell and PowerShell script to remove the invalid characters from the Entities.xml and re-zip the restore file.
Content of PowerShell script:
$yourfile = "C:\Users\x889390\Downloads\ADTA Wiki Copy\entities.xml"
$outputfile = "C:\Users\x889390\Downloads\ADTA Wiki Copy\entities_clean.xml"
function Repair-XmlString {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true, Position = 0,ValueFromPipeline)]
[ValidateNotNullOrEmpty()]
[string]$String
)
#Write-Host "Cleaning string for XML parsing [String: $($String)]"
$rPattern = "[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000\x10FFFF]"
$cleaned = $String -replace $rPattern, ''
#Write-Host "Returning parsed string [String cleaned: $($cleaned)]"
return $cleaned
}
Repair-XmlString (Get-Content $yourfile -Raw) |Set-Content $outputfile
#/get-content -Raw -path $yourfile | out-file $outputfile -encoding utf8
https://powershellexplained.com/2017-07-31-Powershell-regex-regular-expression/
Tad Foster
IT Product Manager Administrator Analyst
Kaiser Permanente
Denver, CO
2 accepted answers
0 comments