test-read.ps1 1.0 KB

123456789101112131415161718192021222324252627
  1. $f = "e:\workspace\openclaw-voc-skill\voc\asin-sales-volume\api-config.json"
  2. $c1 = Get-Content $f -Raw -Encoding UTF8
  3. $c2 = [System.IO.File]::ReadAllText($f, [System.Text.Encoding]::UTF8)
  4. Write-Host "GC null: $($null -eq $c1)"
  5. Write-Host "RT null: $($null -eq $c2)"
  6. Write-Host "GC len: $($c1.Length)"
  7. Write-Host "RT len: $($c2.Length)"
  8. $token = "tokenConfig"
  9. Write-Host "GC IndexOf: $($c1.IndexOf($token))"
  10. Write-Host "RT IndexOf: $($c2.IndexOf($token))"
  11. # Show first 200 chars raw bytes around the expected position
  12. $bytes = [System.IO.File]::ReadAllBytes($f)
  13. Write-Host "File byte count: $($bytes.Length)"
  14. # Show bytes 2000-2010 (rough position of "tokenConfig" based on line ~99)
  15. $near = $bytes[2900..2950]
  16. Write-Host "Bytes near pos 2900: $($near -join ' ')"
  17. # Check with quotes
  18. $token2 = '"tokenConfig"'
  19. Write-Host "IndexOf with quotes: $($c1.IndexOf($token2))"
  20. # Show 10 chars around position 1972
  21. Write-Host "Chars 1965-1995: $(($c1[1965..1995] | ForEach-Object { [int]$_ }) -join ' ')"
  22. Write-Host "String around: $($c1.Substring(1965, 30))"